File: bin_to_hex_file.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-- 641 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 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();