my($this, $that, $name) = @_;
my $ok;
- if( !ref $this && !ref $that ) {
+ if( !ref $this || !ref $that ) {
$ok = $Test->is_eq($this, $that, $name);
}
else {
foreach my $idx (0..$#vals) {
my $val = $vals[$idx];
$vals[$idx] = !defined $val ? 'undef' :
- ref $val ? $val eq $DNE ? "Does not exist"
- : $val
- : "'$val'"
+ $val eq $DNE ? "Does not exist"
+ : "'$val'";
}
$out .= "$vars[0] = $vals[0]\n";
return $out;
}
-sub eq_deeply {
- my ($a1, $a2) = @_;
-
- local @Data_Stack = ();
- return _deep_check($a1, $a2);
-}
=item B<eq_array>
=cut
#'#
-
-sub eq_array {
- my ($a1, $a2) = @_;
-
- return UNIVERSAL::isa($a2, "ARRAY") ? eq_deeply($a1, $a2) : 0;
-}
-
-sub _eq_array {
+sub eq_array {
my($a1, $a2) = @_;
return 1 if $a1 eq $a2;
# Quiet uninitialized value warnings when comparing undefs.
local $^W = 0;
- if( ! (ref $e1 xor ref $e2) and $e1 eq $e2 ) {
+ if( $e1 eq $e2 ) {
$ok = 1;
}
else {
- if ( (ref $e1 and $e1 eq $DNE) or
- (ref $e2 and $e2 eq $DNE) )
- {
- $ok = 0;
- }
- elsif( UNIVERSAL::isa($e1, 'ARRAY') and
+ if( UNIVERSAL::isa($e1, 'ARRAY') and
UNIVERSAL::isa($e2, 'ARRAY') )
{
- $ok = _eq_array($e1, $e2);
+ $ok = eq_array($e1, $e2);
}
elsif( UNIVERSAL::isa($e1, 'HASH') and
UNIVERSAL::isa($e2, 'HASH') )
{
- $ok = _eq_hash($e1, $e2);
+ $ok = eq_hash($e1, $e2);
}
elsif( UNIVERSAL::isa($e1, 'REF') and
UNIVERSAL::isa($e2, 'REF') )
{
push @Data_Stack, { type => 'REF', vals => [$e1, $e2] };
$ok = _deep_check($$e1, $$e2);
- pop @Data_Stack if $ok;
}
else {
push @Data_Stack, { vals => [$e1, $e2] };
=cut
sub eq_hash {
- my ($a1, $a2) = @_;
-
- return UNIVERSAL::isa($a2, "HASH") ? eq_deeply($a1, $a2) : 0;
-}
-
-sub _eq_hash {
my($a1, $a2) = @_;
return 1 if $a1 eq $a2;