X-Git-Url: http://git.rot13.org/?p=Biblio-RFID.git;a=blobdiff_plain;f=t%2F10-3M-810.t;h=1099a214aef7f1c7b51af97fc97b5045336ecd80;hp=bd48bdb7378659cd3007b9f2db34e0214f36a87f;hb=75a8809d9f67c952c0db9c3941ec615cace3c716;hpb=45e4058fb35787bad561bad1b57435efec1bbc83 diff --git a/t/10-3M-810.t b/t/10-3M-810.t index bd48bdb..1099a21 100755 --- a/t/10-3M-810.t +++ b/t/10-3M-810.t @@ -1,14 +1,40 @@ #!/usr/bin/perl -use Test::More tests => 2; +use Test::More; # tests => 3; use Data::Dump qw(dump); use lib 'lib'; BEGIN { - use_ok( 'RFID::Serial::3M810' ); + use_ok( 'RFID::Biblio::Reader::3M810' ); } -ok( my $o = RFID::Serial::3M810->new( device => '/dev/ttyUSB0' ), 'new' ); +ok( my $o = RFID::Biblio::Reader::3M810->new( device => '/dev/ttyUSB0' ), 'new' ); +ok( my @tags = $o->inventory, 'inventory' ); +diag dump @tags; +my $old_afi; + +foreach my $tag ( @tags ) { + + ok( my $blocks = $o->read_blocks( $tag ), "read_blocks $tag" ); + + ok( my $afi = $o->read_afi( $tag ), "read_afi $tag" ); + + ok( $o->write_blocks( $tag, $blocks->{$tag} ), "write_blocks $tag" ); + + my $new_afi = "\x42"; + + ok( $o->write_afi( $tag, $new_afi ), sprintf( "write_afi %s %x", $tag, $new_afi ) ); + + cmp_ok( $o->read_afi( $tag ), 'eq', $new_afi, 'AFI check' ); + + ok( $o->write_afi( $tag, $afi ), sprintf( "write_afi %s %x", $tag, $afi ) ); + +} + +ok( my $visible = $o->scan, 'scan' ); +diag dump $visible; + +done_testing();