Data-Hash-Diff-Smart
view release on metacpan or search on metacpan
t/edge_cases.t view on Meta::CPAN
=head1 NAME
edge_cases.t - Destructive, pathological and boundary-condition tests
for Data::Hash::Diff::Smart
=head1 DESCRIPTION
These tests probe the limits of the public API: empty structures, undef
values, extremely deep nesting, very long strings, Unicode, mixed types,
blessed objects, coderefs, IO handles, duplicate keys (impossible in Perl
but simulated via tied hashes), NaN/Inf, overloaded objects, zero/false
values, and adversarial option inputs.
Every test calls only the public interface.
=cut
BEGIN {
use_ok('Data::Hash::Diff::Smart', qw(
diff
diff_text
t/edge_cases.t view on Meta::CPAN
};
subtest 'false value change in array' => sub {
my $r = diff([0], [1]);
is($r->[0]{op}, 'change', '0->1 in array is change');
};
};
# ===========================================================================
# 4. Numeric edge cases: floats, NaN, Inf
# ===========================================================================
subtest 'Numeric edge cases' => sub {
subtest 'integer vs float with same string repr: no change' => sub {
is_deeply(diff({x => 1}, {x => 1.0}), [], '1 vs 1.0: no change');
};
subtest 'floats that differ in string repr: change' => sub {
my $r = diff({x => 1.1}, {x => 1.2});
( run in 0.566 second using v1.01-cache-2.11-cpan-39bf76dae61 )