On Wed, Nov 27, 2002 at 03:24:51PM +0100, Rafael Garcia-Suarez wrote:
> I'd like to have a custom version of is(), say binary_is(), that
> reports 'strings 1 and 2 differ at byte 635, got 0x92, expected 0x42'
> or 'strings 1 differ in length, got 3874, expected 3875'.
>
> Is there already some module that does this ?

Not that I know of.

> If not, what's the best way to implement this myself ? (my tests using
> Test::More.)

Write Test::Binary or something using Test::Builder.  Have it export
binary_is() and then you can just do:

            use Test::More tests => 42;
            use Test::Binary;
            
            is(...);
            binary_is(...);

See http://www.pobox.com/~schwern/talks/Writing_A_Test_Library/full_slides/
for details about using Test::Builder.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
Stupid am I?  Stupid like a fox!

Reply via email to