/[cwmp]/google/t/05-store.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /google/t/05-store.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 99 by dpavlin, Sat Jun 23 09:23:08 2007 UTC revision 100 by dpavlin, Sun Jun 24 18:18:47 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = shift @ARGV;  my $debug = shift @ARGV;
6    
7  use Test::More tests => 14;  use Test::More tests => 17;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
10  use lib 'lib';  use lib 'lib';
# Line 37  my $state = { Line 37  my $state = {
37    
38  cmp_ok( $store->ID_to_uid( 42, $state ), 'eq', 123456, 'ID_to_uid' );  cmp_ok( $store->ID_to_uid( 42, $state ), 'eq', 123456, 'ID_to_uid' );
39    
40  ok( $store->update_state( 42, $state ), 'update_state new' );  ok( $store->update_state( ID => 42, $state ), 'update_state new' );
41    
42  ok( my $store_state = $store->state('42'), 'db->get' );  ok( my $store_state = $store->state( ID => '42'), 'db->get' );
43    
44  is_deeply( $store_state, $state, 'state' );  is_deeply( $store_state, $state, 'state ID' );
45    
46  ok( $store->update_state( 42, { baz => 12345 } ), 'update_state existing' );  ok( $store_state = $store->state( uid =>  123456 ), 'db->get' );
47    
48    is_deeply( $store_state, $state, 'state uid' );
49    
50    ok( $store->update_state( ID => 42, { baz => 12345 } ), 'update_state existing' );
51    
52  $state->{baz} = 12345;  $state->{baz} = 12345;
53    
54  is_deeply( $store->state(42), $state, 'store->state' );  is_deeply( $store->state( ID => 42 ), $state, 'store->state ID' );
55    
56    is_deeply( $store->state( uid => 123456 ), $state, 'store->state uid' );
57    
58  is_deeply( [ $store->known_CPE ], [ 123456 ], 'known_CPE' );  is_deeply( [ $store->known_CPE ], [ 123456 ], 'known_CPE' );
59    
60  ok( $store->update_state( 11, { DeviceID => { SerialNumber => 99999 } } ), 'new device' );  ok( $store->update_state( ID => 11, { DeviceID => { SerialNumber => 99999 } } ), 'new device' );
61    
62  is_deeply( [ $store->known_CPE ], [ 123456, 99999 ], 'known_CPE' );  is_deeply( [ $store->known_CPE ], [ 123456, 99999 ], 'known_CPE' );
63    

Legend:
Removed from v.99  
changed lines
  Added in v.100

  ViewVC Help
Powered by ViewVC 1.1.26