File: 02-X.t

package info (click to toggle)
libgraphics-colornames-perl 3.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 276 kB
  • sloc: perl: 1,458; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (2)
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/perl

use strict;

use Test::More tests => 19;

use_ok( 'Graphics::ColorNames', 2.1002, qw( hex2tuple tuple2hex ) );

tie my %colors, 'Graphics::ColorNames', 'X';
ok( tied %colors );

is( scalar(keys %colors), 676 );    #

my $count = 0;
foreach my $name ( keys %colors ) {
    my @RGB = hex2tuple( $colors{$name} );
    $count++, if ( tuple2hex(@RGB) eq $colors{$name} );
}
ok( $count == keys %colors );

foreach my $ad (qw( royal dodger slate sky steel )) {
    foreach my $col (qw( blue )) {
        ok( exists $colors{"$ad$col"} );
        ok( $colors{"$ad$col"} eq $colors{"$ad $col"},  "$ad $col" );
        ok( $colors{"$ad-$col"} eq $colors{"$ad $col"}, "$ad $col" );
    }
}