App-Bin-Search
view release on metacpan or search on metacpan
t/App-Bin-Search/04-run.t view on Meta::CPAN
use strict;
use warnings;
use App::Bin::Search;
use English;
use File::Object;
use File::Spec::Functions qw(abs2rel);
use Test::More 'tests' => 10;
use Test::NoWarnings;
use Test::Output;
use Test::Warn;
# Test.
@ARGV = (
'-h',
);
my $right_ret = help();
stderr_is(
sub {
App::Bin::Search->new->run;
return;
},
$right_ret,
'Run help (-h).',
);
# Test.
@ARGV = ();
$right_ret = help();
stderr_is(
sub {
App::Bin::Search->new->run;
return;
},
$right_ret,
'Run help (no options).',
);
# Test.
@ARGV = (
'-x',
);
$right_ret = help();
stderr_is(
sub {
warning_is { App::Bin::Search->new->run; } "Unknown option: x\n",
'Warning about bad argument';
return;
},
$right_ret,
'Run help (-x - bad option).',
);
# Test.
@ARGV = (
'FFABCD',
'D5',
);
$right_ret = <<"END";
Found D5E68 at 8 bit
END
stdout_is(
sub {
App::Bin::Search->new->run;
return;
},
$right_ret,
'Search D5 in FFABCD (default - hexadecimal output).',
);
# Test.
@ARGV = (
'-v',
'FFABCD',
'D5',
);
$right_ret = <<"END";
Hexadecimal stream: FFABCD
Size of hexadecimal stream: 24
Looking for: D5
FFABCD at 1bit
FF579A at 2bit
FEAF34 at 3bit
FD5E68 at 4bit
FABCD at 5bit
F579A at 6bit
EAF34 at 7bit
D5E68 at 8bit
Found D5E68 at 8 bit
ABCD at 9bit
579A at 10bit
AF34 at 11bit
5E68 at 12bit
BCD at 13bit
79A at 14bit
F34 at 15bit
E68 at 16bit
CD at 17bit
9A at 18bit
34 at 19bit
68 at 20bit
D at 21bit
A at 22bit
4 at 23bit
( run in 1.543 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )