File: 10box.t

package info (click to toggle)
libmath-polygon-perl 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: perl: 1,598; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (4)
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
27
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More tests => 2;

use lib '../lib';
use Math::Polygon::Calc;

sub compare_box($$)
{   my ($a, $b) = @_;
#warn "[@$a] == [@$b]\n";

       $a->[0] == $b->[0]
    && $a->[1] == $b->[1]
    && $a->[2] == $b->[2]
    && $a->[3] == $b->[3]
}

my @bb1 = polygon_bbox [3,4];
ok(compare_box(\@bb1, [3,4,3,4]));

my @bb2 = polygon_bbox [0,2], [1,2], [2,1], [2,0], [1,-1]
                      , [0,-1], [-1,0], [-1,1], [0,2];

ok(compare_box(\@bb2, [-1,-1, 2,2]));