File: lib.pl

package info (click to toggle)
libgd-text-perl 0.86-8
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 248 kB
  • sloc: perl: 835; makefile: 10
file content (26 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# allow a 2 pixel difference between the values in array ref 1 and array
# ref 2

eval { local $SIG{'__WARN__'}; require Test::More };
if ($@)
{
    # Test::More is not available
    print "1..1\n";
    print "ok 1 # skip Skipping all tests: No Test::More\n";
    exit 0;
}

sub main::aeq
{
    my ($a1, $a2, $e) = @_;
    $e = 0 unless $e;
    return 0 if @$a1 != @$a2;
    for (my $i = 0; $i < @$a1; $i++)
    {
        return 0 if $a1->[$i] > $a2->[$i] + $e || 
                    $a1->[$i] < $a2->[$i] - $e;
    }
    return 1;
}

1;