5 |
|
|
6 |
use blib; |
use blib; |
7 |
|
|
8 |
use Test::More tests => 14; |
use Test::More tests => 25; |
9 |
use Test::Exception; |
use Test::Exception; |
10 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
11 |
|
|
41 |
|
|
42 |
ok( tcidbput( $idb, 1, 'foobar' ), 'tcidbput' ); |
ok( tcidbput( $idb, 1, 'foobar' ), 'tcidbput' ); |
43 |
|
|
44 |
|
ok( tcidbout( $idb, 1, ), 'tcidbout' ); |
45 |
|
|
46 |
|
ok( tcidbput( $idb, 42, 'some data' ), 'tcidbput again' ); |
47 |
|
is( tcidbget( $idb, 42 ), 'some data', 'tcidbget' ); |
48 |
|
ok( ! tcidbget( $idb, 1 ), 'tcidbget non-existing' ); |
49 |
|
|
50 |
|
is_deeply( tcidbsearch( $idb, 'some', IDBSSUBSTR ), [ 42 ], 'tcidbsearch' ); |
51 |
|
ok( tcidbput( $idb, 65536, 'some more data' ), 'tcidbput more data' ); |
52 |
|
is_deeply( tcidbsearch( $idb, 'some', IDBSSUBSTR ), [ 42, 65536 ], 'tcidbsearch' ); |
53 |
|
|
54 |
|
ok( tcidbiterinit( $idb ), 'tcidbiterinit' ); |
55 |
|
|
56 |
|
my @ids; |
57 |
|
|
58 |
|
while ( my $id = tcidbiternext( $idb ) ) { |
59 |
|
ok( $id, "tcidbiternext $id" ); |
60 |
|
push @ids, $id; |
61 |
|
} |
62 |
|
|
63 |
|
# order is not defined, so we need to sort it |
64 |
|
is_deeply( [ sort @ids ], [ 42, 65536 ], 'all records' ); |
65 |
|
|
66 |
diag tcidberrmsg( tcidbecode( $idb ) ); |
diag tcidberrmsg( tcidbecode( $idb ) ); |