Test::...rences(3pm)
π NAME π
okay so bestie, this is the manual page for Test::HexDifferences β it's Test::...rences(3pm) if you're reading the header up top, and it lives in the User Contributed Perl Documentation section. What it does? Test binary as hexadecimal string. That's the whole vibe. π¦
β¨ VERSION β¨
1.001 β that's the one, no cap.
π§ SYNOPSIS π§
okay bestie, here's the whole menu of ways you can call this thing π
use Test::HexDifferences;
eq_or_dump_diff(
$got,
$expected,
);
eq_or_dump_diff(
$got,
$expected,
$test_name,
);
eq_or_dump_diff(
$got,
$expected,
{
address => $start_address,
format => "%a : %4C : %d\n",
}
$test_name,
);
and here's the tea: if $got or $expected is "undef" or a reference, the hexadecimal formatter is OFF. like, fully off. and then eq_or_dump_diff is just a text compare. that's it, that's the rule. π
dumped_eq_dump_or_diff(
$got_value,
$expected_dump,
);
dumped_eq_dump_or_diff(
$got_value,
$expected_dump,
$test_name,
);
dumped_eq_dump_or_diff(
$got_value,
$expected_dump,
{
address => $start_address,
format => "%a : %4C : %d\n",
}
$test_name,
);
want the full deets on the format string? go peek at Test::HexDifferences::HexDump for the format description π
πΈ EXAMPLE πΈ
inside of this Distribution there's a directory named example β yes, lowercase, iconic. go run those *.t files, they're literally right there. π
π DESCRIPTION π
so the thing is, testing binary data has some special cases and we gotta talk about them:
- the ascii format is not good for stuff like a length byte
0x41that just gets displayed asA. like ma'am that is not helpful π - multibyte values are way better shown as 1 value. one. single. value. periodt.
- structured binary β think
2 byte lengthfollowed by bytes β is better shown as it is. don't touch it, let it be its authentic self π«Ά - and the whole point: compare 2 binary, or 1 binary and a dump β¨
π SUBROUTINES/METHODS π
subroutine eq_or_dump_diff
eq_or_dump_diff(
$got_value,
$expected_value,
{ # optional hash reference
address => $display_start_address, # optional
format => $format_string, # optional
}
$test_name, # optional
);
subroutine dumped_eq_dump_or_diff
dumped_eq_dump_or_diff(
$got_value,
$expected_dump,
{ # optional hash reference
address => $display_start_address, # optional
format => $format_string, # optional
}
$test_name, # optional
);
π DIAGNOSTICS π
nothing π β literally nothing to report, she's quiet.
π CONFIGURATION AND ENVIRONMENT π
nothing β no environment variables, no config, no drama. we love a low-maintenance queen π
β DEPENDENCIES β
these are the besties she rolls with:
Sub::ExporterTest::Builder::ModuleTest::HexDifferences::HexDumpText::Diff
π INCOMPATIBILITIES π
none β she gets along with everybody π«Ά
π BUGS AND LIMITATIONS π
none β flawless, obviously π
π₯ SEE ALSO π₯
Test::HexDifferences::HexDump
π AUTHOR π
Steffen Winkler β the icon, the moment, the main character π
π LICENSE AND COPYRIGHT π
Copyright (c) 2012 - 2015, Steffen Winkler "<steffenw at cpan.org>". All rights reserved.
this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay. β¨
okay bestie that's the whole page π¦ this was perl v5.30.3, dated 2020-08-04, filed under Test::...rences(3pm) β mwah, take care, go test your bytes π
π¦ where this page comes from
- debian bookworm: libtest-hexdifferences-perl 1.001-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtest-hexdifferences-perl 1.001-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libtest-hexdifferences-perl 1.001-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtest-hexdifferences-perl 1.001-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest-hexdifferences-perl 1.001-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-hexdifferences-perl 1.001-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms