X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F20-CPR-M02.t;h=1fbf05c8e6f7043e3799981eff27a85fcad9a243;hb=0dd4f35728c1e33825d5bb2f86104a483168c24d;hp=f8b8f4cf09cbb7bc9ae2ed30f9ea99c88d4ec2cb;hpb=93623e9dcaf13cb5c91744182c0d57e97d0a4af0;p=Biblio-RFID.git diff --git a/t/20-CPR-M02.t b/t/20-CPR-M02.t index f8b8f4c..1fbf05c 100755 --- a/t/20-CPR-M02.t +++ b/t/20-CPR-M02.t @@ -1,16 +1,30 @@ #!/usr/bin/perl -use Test::More tests => 3; +use Test::More; use Data::Dump qw(dump); use lib 'lib'; BEGIN { - use_ok( 'RFID::Serial::CPRM02' ); + use_ok( 'RFID::Biblio::Reader::CPRM02' ); } -ok( my $o = RFID::Serial::CPRM02->new( device => '/dev/ttyUSB0' ), 'new' ); +ok( my $o = RFID::Biblio::Reader::CPRM02->new( device => '/dev/ttyUSB0' ), 'new' ); -ok( $o->inventory, 'inventory' ); +ok( my @tags = $o->inventory, 'inventory' ); +foreach my $tag ( @tags ) { + ok( my $blocks = $o->read_blocks( $tag ), "read_blocks $tag" ); + + my $pattern = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"; + ok( $o->write_blocks( $tag, $pattern ), "write_blocks $tag" ); + + $pattern = "0123456789ABCDEF....."; + ok( $o->write_blocks( $tag, $pattern ), "write_blocks $tag" ); + +# ok( $o->write_blocks( $tag, $blocks->{$tag} ), "write_blocks $tag" ); + +} + +done_testing;