X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/d74e2a35bb0db0d88b074e5715b051da9c8f658e..dd3c57bc8cac59e0d657ee665ce462988d27d714:/da-gtest diff --git a/da-gtest b/da-gtest index 4412e49..0348833 100755 --- a/da-gtest +++ b/da-gtest @@ -11,6 +11,7 @@ # reduce n -- remove n items from end # set i n -- assign item at index i to be n # get i -- display item at index i +# first, last -- show first or last item # show -- write entire array to stdout, space separated on one line sub random ($) { @@ -22,7 +23,7 @@ $lines = shift || 100; $max = 0; # Estimate of size of array $serial = 1; while ($lines) { - $what = random(17); + $what = random(21); if ($what < 8) { my $op = (qw(push pop shift unshift))[$what % 4]; if ($op eq "push" || $op eq "unshift") { @@ -61,6 +62,9 @@ while ($lines) { } else { print "get $i\n"; } + } elsif ($what < 20) { + my $op = (qw(first last))[$what % 2]; + print "$op\n" if $max; } elsif (random(10) == 0) { print "show\n"; } else { next; }