diff options
Diffstat (limited to 't')
-rw-r--r-- | t/op.sort | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -1,8 +1,8 @@ #!./perl -# $Header: op.sort,v 3.0 89/10/18 15:31:19 lwall Locked $ +# $Header: op.sort,v 3.0.1.1 89/10/26 23:25:37 lwall Locked $ -print "1..3\n"; +print "1..8\n"; sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; } @@ -17,3 +17,23 @@ print ($x eq 'xdogcatCainAbel' ? "ok 2\n" : "not ok 2\n"); $x = join('', sort @george, 'to', @harry); print ($x eq 'AbelAxedCainPunishedcatchaseddoggonetoxyz'?"ok 3\n":"not ok 3\n"); + +@a = (); +@b = reverse @a; +print ("@b" eq "" ? "ok 4\n" : "not ok 4 (@b)\n"); + +@a = (1); +@b = reverse @a; +print ("@b" eq "1" ? "ok 5\n" : "not ok 5 (@b)\n"); + +@a = (1,2); +@b = reverse @a; +print ("@b" eq "2 1" ? "ok 6\n" : "not ok 6 (@b)\n"); + +@a = (1,2,3); +@b = reverse @a; +print ("@b" eq "3 2 1" ? "ok 7\n" : "not ok 7 (@b)\n"); + +@a = (1,2,3,4); +@b = reverse @a; +print ("@b" eq "4 3 2 1" ? "ok 8\n" : "not ok 8 (@b)\n"); |