]> wagnertech.de Git - mfinanz.git/blob - t/Support/TestRoutines.pm
date error in mapping
[mfinanz.git] / t / Support / TestRoutines.pm
1 package Support::TestRoutines;
2
3 use Test::More;
4 use List::MoreUtils qw(any);
5
6 require Exporter;
7 our @ISA = qw(Exporter);
8
9 our @EXPORT = qw(test_deeply);
10
11 sub test_deeply {
12   my ($first, $second, $description, @ignore_keys) = @_;
13
14   my @first_keys = keys %{$first};
15   my @second_keys = keys %{$second};
16   foreach my $key (@first_keys) {
17     if (!any { $_ eq $key } @ignore_keys) {
18       if (!any { $_ eq $key } @second_keys) {
19         ok(0, $description . ": " . $key);
20       }
21     }
22   }
23   foreach my $key (@second_keys) {
24     if (!any { $_ eq $key } @ignore_keys) {
25       if (!any { $_ eq $key } @first_keys) {
26         ok(0, $description . ": " . $key);
27       } else {
28         is($first->{$key}, $second->{$key}, $description . ": " . $key);
29       }
30     }
31   }
32 }
33