File: 44mirror.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 (55 lines) | stat: -rw-r--r-- 1,147 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More tests => 8;

use lib '../lib';
use Math::Polygon::Transform;
use Math::Polygon::Calc       qw/polygon_string/;

my @p = ([0,0], [1,1], [-2,1], [-2,-2], [0,0]);

is( polygon_string(polygon_mirror x => 1, @p)
  , "[2,0], [1,1], [4,1], [4,-2], [2,0]"
  , 'x=1'
  );

is( polygon_string(polygon_mirror y => 1, @p)
  , "[0,2], [1,1], [-2,1], [-2,4], [0,2]"
  , 'y=1'
  );

is( polygon_string(polygon_mirror rc => 1, @p)
  , "[0,0], [1,1], [1,-2], [-2,-2], [0,0]"
  , 'y=x'
  );

is( polygon_string(polygon_mirror rc => undef, b => 1, @p)
  , "[2,0], [1,1], [4,1], [4,-2], [2,0]"
  , 'x=1'
  );

is( polygon_string(polygon_mirror rc => -1, b => -1, @p)
  , "[-1,-1], [-2,-2], [-2,1], [1,1], [-1,-1]"
  , 'y=-x-1'
  );


is( polygon_string(polygon_mirror line => [[0,0],[1,1]], @p)
  , "[0,0], [1,1], [1,-2], [-2,-2], [0,0]"
  , 'y=x'
  );

is( polygon_string(polygon_mirror line => [[0,-1],[-3,2]], @p)
  , "[-1,-1], [-2,-2], [-2,1], [1,1], [-1,-1]"
  , 'y=-x-1'
  );

is( polygon_string(polygon_mirror line => [[1,-3],[1,10]], @p)
  , "[2,0], [1,1], [4,1], [4,-2], [2,0]"
  , 'x=1'
  );