File: hex_to_bin_oo.t

package info (click to toggle)
libconvert-binhex-perl 1.125-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 332 kB
  • sloc: perl: 824; makefile: 8
file content (32 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;

use Test::Most;
use FindBin '$Bin';
use File::Slurp;
use autodie;

my $binhex_file = "$Bin/../testin/eyeball.gif.hqx";
my $orig_file = "$Bin/../testin/eyeball.gif";

use Convert::BinHex;

# Test hex to bin, OO interface

open( my $in_fh, $binhex_file);

my $hqx = Convert::BinHex->open( FH => $in_fh );
$hqx->read_header();
my @data = $hqx->read_data();
my @rsrc = $hqx->read_resource();

my $orig_data = read_file( $orig_file, { 'binmode' => ':raw' });

eq_or_diff(join('', @data), $orig_data, 'data fork matches original');
is_deeply(\@rsrc, [], 'resource fork is empty');

is($hqx->filename(), 'eyeball.gif', 'filename is correct');
is($hqx->type(), '????', 'type is correct');
is($hqx->creator(), '????', 'creator is correct');

done_testing();