added com2tcp windows binary i386
[Biblio-RFID.git] / t / 05-RFID501.t
1 #!/usr/bin/perl
2
3 use Test::More tests => 8;
4 use Data::Dump qw(dump);
5
6 use lib 'lib';
7
8 BEGIN {
9         use_ok( 'Biblio::RFID::RFID501' );
10 }
11
12 my $tags =
13 [ [
14         "\4\21\0\0",
15         2009,
16         "0101",
17         "0123",
18         "\0\0\0\0",
19         "\xFF\xFF\xFF\xFF",
20         "\x7F\xFF\xFF\xFF",
21         "\0\0\0\0",
22 ],[
23         "\4\21\0\1",
24         1302,
25         "0037",
26         "67\0\0",
27         "\0\0\0\0",
28         "\0\0\0\0",
29         "\0\0\0\0",
30         "\0\0\0\0",
31 ] ];
32
33 foreach my $tag ( @$tags ) {
34
35         ok( $hash = Biblio::RFID::RFID501->to_hash( $tag ), 'to_hash' );
36         diag dump $hash;
37
38         ok( $bytes = Biblio::RFID::RFID501->from_hash( $hash ), 'from_hash' );
39         my $orig = join('', @$tag);
40         cmp_ok( $bytes, 'eq', $orig, 'roundtrip' );
41
42         diag dump( $orig, $bytes );
43
44 }
45
46 ok( my $bytes = Biblio::RFID::RFID501->blank, 'blank' );
47 diag dump $bytes;
48