Test::Bits(3pm)
β¨ Test::Bits β¨
okay bestie so this is the Test::Bits page from the User Contributed Perl Documentation (that's the 3pm energy, iykyk) and it's literally just here to hand you one (1) little subroutine that tests binary data. that's it. that's the whole vibe. π
πΈ NAME πΈ
Test::Bits β provides a bits_is() subroutine for testing binary data π
π VERSION π
version 0.02
β¨ SYNOPSIS β¨
okay here's the whole moment, look at her:
use Test::Bits;
bits_is(
$binary_data,
[ 0b0010101, 0b01111100 ],
'binary data contains expected values'
);
π¦ DESCRIPTION π¦
so this module gives you exactly one subroutine, bits_is(), and its whole job is testing binary data. one job. iconic behavior fr. π
conceptually? she's lowkey cousins with Test::BinaryData and Test::HexString. the difference is that this module shows failure diagnostics in a different way, and the calling style is a slightly different flavor. depending on the nature of the data you're working with, this module might just be easier to work with. it's giving "the right tool for the right girlie." π«Ά
specifically: when you're doing a lot of bit twiddling, this module's diagnostic output may make it easier to diagnose failures. a typical failure diagnostic looks like this:
The two pieces of binary data are not the same length (got 2, expected 3).
Binary data begins differing at byte 1.
Got: 01111000
Expect: 01111001
heads up bestie: the bytes are numbered starting from 0 in the diagnostic output. zero-indexed girlies, we stay winning. π
π USAGE π
the bits_is() subroutine takes two required arguments and an optional test name. three slots, no notes. π
- the first argument should be a plain scalar containing binary data. if it contains any UTF-8 characters, an error will be thrown. π¨ so like... don't do that.
- the second argument should be an array reference of numbers from
0-255representing the expected value of each byte in the first argument.
and the reason that second one slaps so hard is that it lets you write the numbers out in binary format (0bXXXXXXXX) for your test cases if you want to. bit-coded test cases, periodt. β
π BUGS π
found a bug or want a feature? please report it, bestie, we wanna know!! π
- mail it to
bug-test-bits@rt.cpan.org - or go through the web interface at
http://rt.cpan.org
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. that's the deal. tracking numbers, transparency, all of it. π
π AUTHOR π
Dave Rolsky <autarch@urth.org>
π COPYRIGHT AND LICENSE π
this software is Copyright (c) 2013 by MaxMind, Inc.. π
this is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
so yeah, that's the whole page β Test::Bits, version 0.02, from the User Contributed Perl Documentation, dated 2022-11-20 and built for perl v5.36.0. go forth and test your binary data, bestie, you're gonna slay it π β¨π¦
π¦ where this page comes from
- debian bookworm: libtest-bits-perl 0.02-3 Β· Artistic-2.0
- debian trixie: libtest-bits-perl 0.02-3 Β· Artistic-2.0
- ubuntu noble: libtest-bits-perl 0.02-3 Β· Artistic-2.0
- ubuntu resolute: libtest-bits-perl 0.02-3 Β· Artistic-2.0
- ubuntu stonking: libtest-bits-perl 0.02-3 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms