2
2
3
3
use v5.12;
4
4
use warnings;
5
- use Test::More tests => 75 ;
5
+ use Test::More tests => 91 ;
6
6
use Test::Warn;
7
7
8
8
BEGIN { unshift @INC , ' lib' , ' ../lib' }
@@ -20,7 +20,7 @@ is( Graphics::Toolkit::Color::Space::Shape->new( $basis, {}), undef, 'range defi
20
20
is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3] ]), undef , ' not enough dimensions' );
21
21
is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[1,3],[1,3] ]), undef , ' too many dimensions' );
22
22
is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[1] ]), undef , ' one dimension had too short def' );
23
- is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[1,2,3] ]), undef , ' one dimension had too long def' );
23
+ is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[1,2,3,4 ] ]), undef , ' one dimension had too long def' );
24
24
is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[2,2] ]), undef , ' range min is not smaller than max' );
25
25
is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[1,2] ],{}), undef , ' type def has to be array too' );
26
26
is( Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[1,3],[1,3],[1,2] ],[1,1]), undef , ' type def too short' );
@@ -30,8 +30,31 @@ is( Graphics::Toolkit::Color::Space::Shape->new( $basis, [[1,3],[1,3],[1,2] ],[1
30
30
31
31
my $shape = Graphics::Toolkit::Color::Space::Shape-> new( $basis , 20);
32
32
is( ref $shape , $module , ' created shape with 0..20 range' );
33
+ is( $shape -> dimension_is_int(0), 1, ' first dimension outputs is int values' );
34
+ is( $shape -> dimension_is_int(1), 1, ' second dimension outputs is int values' );
35
+ is( $shape -> dimension_is_int(2), 1, ' third dimension outputs is int values' );
36
+ is( $shape -> dimension_is_int(3), undef , ' there is no fourth dimension ' );
37
+
33
38
my $bshape = Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[-5,5],[-5,5],[-5,5]], [' angular' , ' circular' , 0]);
34
39
is( ref $bshape , $module , ' created 3D bowl shape with -5..5 range' );
40
+ is( $bshape -> dimension_is_int(0), 1, ' first dimension outputs is int values' );
41
+ is( $bshape -> dimension_is_int(1), 1, ' second dimension outputs is int values' );
42
+ is( $bshape -> dimension_is_int(2), 1, ' third dimension outputs is int values' );
43
+
44
+ my $nshape = Graphics::Toolkit::Color::Space::Shape-> new( $basis , ' normal' );
45
+ is( $nshape -> dimension_is_int(0), 0, ' first normal dimension outputs is not int' );
46
+ is( $nshape -> dimension_is_int(1), 0, ' second normal dimension outputs is not int' );
47
+ is( $nshape -> dimension_is_int(2), 0, ' third normal dimension outputs is not int' );
48
+
49
+ my $mshape = Graphics::Toolkit::Color::Space::Shape-> new( $basis , [' normal' , 100, [2, 2.2]]);
50
+ is( $mshape -> dimension_is_int(0), 0, ' first particular normal dimension is not int' );
51
+ is( $mshape -> dimension_is_int(1), 1, ' second dimension defined by int is int' );
52
+ is( $mshape -> dimension_is_int(2), 0, ' third dimension defined by real range is not int' );
53
+
54
+ my $oshape = Graphics::Toolkit::Color::Space::Shape-> new( $basis , [[0, 10, ' int' ], [0, 10, ' real' ], [0, 10, ' r' ],]);
55
+ is( $oshape -> dimension_is_int(0), 1, ' first dimension outputs is int' );
56
+ is( $oshape -> dimension_is_int(1), 0, ' second dimension outputs is not int' );
57
+ is( $oshape -> dimension_is_int(2), 0, ' third dimension outputs is not int' );
35
58
36
59
my @d = $shape -> delta(1, [1,5,4,5] );
37
60
is( int @d , 0, ' reject compute delta on none vector on first arg position' );
0 commit comments