1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
4 ######################### We start with some black magic to print on failure.
6 # Change 1..1 below to 1..last_test_to_print .
7 # (It may become useful if the test is moved to ./t subdirectory.)
9 BEGIN { $| = 1; print "1..8\n"; }
10 END {print "not ok 1\n" unless $loaded;}
11 use Devel::Size qw(size total_size);
15 ######################### End of black magic.
17 # Insert your test code below (better if it prints "ok 13"
18 # (correspondingly "not ok 13") depending on the success of chunk 13
21 use vars qw($foo @foo %foo);
24 %foo = (a => 1, b => 2);
27 my $y = "A longer string";
28 if (size($x) < size($y)) {
34 if (total_size($x) < total_size($y)) {
43 if (size(\@x) < size(\@y)) {
49 if (total_size(\@x) < total_size(\@y)) {
55 # check that the tracking_hash is working
58 my @ary1 = (\$a, \$a);
59 my @ary2 = (\$a, \$b);
61 if (total_size(\@ary1) < total_size(\@ary2)) {
67 # check that circular references don't mess things up
69 my($c1,$c2); $c2 = \$c1; $c1 = \$c2;
71 if( total_size($c1) == total_size($c2) ) {
77 if (total_size(*foo)) {