From ddb42995dc4234ebeacd8d75fe700a6fc0b926da Mon Sep 17 00:00:00 2001 From: Stephen Nelson Date: Sun, 25 Aug 2013 14:47:14 -0700 Subject: [PATCH] Test going from bin to hex via file interface --- t/bin_to_hex_file.t | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 t/bin_to_hex_file.t diff --git a/t/bin_to_hex_file.t b/t/bin_to_hex_file.t new file mode 100644 index 0000000..a526f1c --- /dev/null +++ b/t/bin_to_hex_file.t @@ -0,0 +1,32 @@ +use strict; +use warnings; + +use autodie; + +use Test::Most; +use FindBin '$Bin'; +use File::Temp; +use File::Compare; + +use Convert::BinHex; + +my $source_file = "$Bin/../testin/eyeball.gif"; +my $comparison = "$Bin/../testin/eyeball.gif.hqx"; +#my $comparison = "$Bin/../testin/hands_m.eps.hqx"; + + +my $hqx = Convert::BinHex->new(); +$hqx->filename('eyeball.gif'); +$hqx->type('????'); +$hqx->creator('????'); +$hqx->data( Path => $source_file ); +$hqx->resource( Data => '' ); + +my $tmp_fh = File::Temp->new(); +$hqx->encode($tmp_fh); +$tmp_fh->flush(); +$tmp_fh->seek(0,0); + +ok( compare( $tmp_fh, $comparison) == 0, "File is binary correct"); + +done_testing(); \ No newline at end of file