]>
iEval git - convert-color-hsluv.git/blob - t/Convert-Color-HUSL.t
5 use Convert
::Color
::RGB8
;
6 use JSON
::PP qw
/decode_json/;
7 use Test
::More tests
=> 5 * 4096;
9 use constant EPSILON
=> $ENV{RELEASE_TESTING
} ?
1e-11 : 2e-4;
10 my @spaces = qw
/XYZ LUV LCh HUSL HUSLp/;
13 my ($x, $y, $name) = @_;
14 ok
!grep({ abs ($_ - shift @
$y) > EPSILON
} @
$x), $name;
17 if ($ENV{RELEASE_TESTING
}) {
18 require JSON
::MaybeXS
;
19 open my $fh, '<', 't/snapshot-rev4.json';
20 my $snapshot = join '', <$fh>;
22 my %tests = %{JSON
::MaybeXS
::decode_json
$snapshot};
24 for my $color (sort keys %tests) {
25 my $col = Convert
::Color
::RGB8
->new(substr $color, 1);
26 isf
$col->convert_to(lc), $tests{$color}{lc()}, "convert $color to $_" for @spaces;
29 open my $fh, '<', 't/snapshot-rev4.csv';
33 my ($color, @good) = split ',';
34 my $col = Convert
::Color
::RGB8
->new($color);
35 isf
$col->convert_to(lc), \
@good, "convert $color to $_" for @spaces
This page took 0.052318 seconds and 4 git commands to generate.