GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEST::BITS (3)

.ds Aq ’

NAME

Test::Bits - Provides a bits_is() subroutine for testing binary data

CONTENTS

VERSION

version 0.02

SYNOPSIS



  use Test::Bits;

  bits_is(
      $binary_data,
      [ 0b0010101, 0b01111100 ],
      binary data contains expected values
  );



DESCRIPTION

This module provides a single subroutine, bits_is(), for testing binary data.

This module is quite similar to Test::BinaryData and Test::HexString in concept. The difference is that this module shows failure diagnostics in a different way, and has a slightly different calling style. Depending on the nature of the data you’re working with, this module may be easier to work with.

In particular, 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 will look 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



Note that the bytes are numbered starting from 0 in the diagnostic output.

USAGE

The bits_is() subroutine takes two required arguments and an optional test name.

The first argument should be a plain scalar containing binary data. If it contains any UTF-8 characters an error will be thrown.

The second argument should be an array reference of numbers from 0-255 representing the expected value of each byte in the first argument.

This allows you write the numbers out in binary format (0bXXXXXXXX) for test cases if you wish to.

BUGS

Please report any bugs or feature requests to bug-test-bits@rt.cpan.org, or 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.

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)



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEST::BITS (3) 2013-06-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.