Added unit tests for hex to bin, object-oriented

This commit is contained in:
Stephen Nelson 2013-08-25 14:11:27 -07:00
parent d133e6b293
commit bc1e59e952
1 changed files with 28 additions and 0 deletions

28
t/hex_to_bin_oo.t Normal file
View File

@ -0,0 +1,28 @@
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');
done_testing();