canonical.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!./perl
#
# Copyright (c) 1995-2000, Raphael Manfredi
#
# You may redistribute only under the same terms as Perl 5, as specified
# in the README file that comes with the distribution.
#
sub BEGIN {
chdir('t') if -d 't';
} else {
}
print "1..0 # Skip: Storable was not built\n";
exit 0;
}
}
print "1..8\n";
sub ok {
}
# Uncomment the folowing line to get a dump of the constructed data structure
# (you may want to reduce the size of the hashes too)
# $debugging = 1;
$hashsize = 100;
$maxhash2size = 100;
$maxarraysize = 100;
# Use MD5 if its available to make random string keys
$gotmd5 = !$@;
# Use Data::Dumper if debugging and it is available to create an ASCII dump
$gotdd = !$@;
}
"July", "August", "September", "October", "November", "December" );
# Build some arbitrarily complex data structure starting with a top level hash
# (deeper levels contain scalars, references to hashes or references to arrays);
# A third of the elements are references to further hashes
}
}
# A further third are references to arrays
}
}
}
# Copy the hash, element by element in order of the keys
}
# Deep clone the hash
# In canonical mode the frozen representation of each of the hashes
# should be identical
# In normal mode it is exceedingly unlikely that the frozen
# representaions of all the hashes will be the same (normally the hash
# elements are frozen in the order they are stored internally,
# i.e. pseudo-randomly).
# Two out of three the same may be a coincidence, all three the same
# is much, much more unlikely. Still it could happen, so this test
# may report a false negative.
# Ensure refs to "undef" values are properly shared
my $hash;