import Devel-Size 0.55 from CPAN
[p5sagit/Devel-Size.git] / t / basic.t
index b096f73..05bdc6a 100644 (file)
--- 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";
+}
+