X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F10-3M-810.t;h=259d18d47292e4697323be9b3325078010721092;hb=55baf82bee4acf05f093c6bf70a359bda7feb3ba;hp=66938c113ced32f0b3afa35eb50112c56595007a;hpb=b9bf276a9f48c5d2b5aa14473df14ca37dc1d76a;p=Biblio-RFID.git diff --git a/t/10-3M-810.t b/t/10-3M-810.t index 66938c1..259d18d 100755 --- a/t/10-3M-810.t +++ b/t/10-3M-810.t @@ -1,15 +1,40 @@ #!/usr/bin/perl -use Test::More tests => 3; +use Test::More; # tests => 3; use Data::Dump qw(dump); use lib 'lib'; BEGIN { - use_ok( 'RFID::Serial::3M810' ); + use_ok( 'RFID::Biblio::3M810' ); } -ok( my $o = RFID::Serial::3M810->new( device => '/dev/ttyUSB0' ), 'new' ); +ok( my $o = RFID::Biblio::3M810->new( device => '/dev/ttyUSB0' ), 'new' ); -ok( my $inventory = $o->inventory, 'inventory' ); +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();