File: 08-filehandle.t

package info (click to toggle)
libgraphics-colornames-perl 1.06-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 592 kB
  • ctags: 90
  • sloc: perl: 1,380; makefile: 11
file content (28 lines) | stat: -rw-r--r-- 574 bytes parent folder | download
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
#!/usr/bin/perl

use strict;
use Test::More tests => 10;

use IO::File;

my $fh = new IO::File;
open($fh, './t/rgb.txt');

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

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

ok(keys %colors == 6); #

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 $name (qw( one two three four five six)) {
  ok(exists $colors{$name});
}