X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=05bdc6a37f8f09bd9193328c88ba30679c976fe4;hb=b98fcdb93f447c4f556f859c61b15c5fdd502bee;hp=b096f73fc39111fa3174aa31f85e11bb031c8278;hpb=fea63ffab1b34bbefc1f75a7beee2c5bdc96d67e;p=p5sagit%2FDevel-Size.git diff --git a/t/basic.t b/t/basic.t index b096f73..05bdc6a 100644 --- a/t/basic.t +++ b/t/basic.t @@ -6,9 +6,9 @@ # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) -BEGIN { $| = 1; print "1..1\n"; } +BEGIN { $| = 1; print "1..5\n"; } END {print "not ok 1\n" unless $loaded;} -use Devel::Size; +use Devel::Size qw(size total_size); $loaded = 1; print "ok 1\n"; @@ -18,3 +18,33 @@ print "ok 1\n"; # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): + +my $x = "A string"; +my $y = "A longer string"; +if (size($x) < size($y)) { + print "ok 2\n"; +} else { + print "not ok 2\n"; +} + +if (total_size($x) < total_size($y)) { + print "ok 3\n"; +} else { + print "not ok 3\n"; +} + +my @x = (1..4); +my @y = (1..10); + +if (size(\@x) < size(\@y)) { + print "ok 4\n"; +} else { + print "not ok 4\n"; +} + +if (total_size(\@x) < total_size(\@y)) { + print "ok 5\n"; +} else { + print "not ok 5\n"; +} +