--- t/10-xs.t 2008/08/18 18:28:05 18 +++ t/10-xs.t 2008/08/18 18:57:26 24 @@ -5,7 +5,7 @@ use blib; -use Test::More tests => 21; +use Test::More tests => 29; use Test::Exception; use Data::Dump qw/dump/; @@ -33,7 +33,7 @@ ok( tcidbsetfwmmax( $idb, 0 ), 'tcidbsetfwmmax' ); -ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path" ); +ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT | IDBOTRUNC ), "tcidbopen $path" ); ok( tcidbclose( $idb ), 'tcidbclose' ); @@ -51,5 +51,24 @@ ok( tcidbput( $idb, 65536, 'some more data' ), 'tcidbput more data' ); is_deeply( tcidbsearch( $idb, 'some', IDBSSUBSTR ), [ 42, 65536 ], 'tcidbsearch' ); -diag dump( tcidbsearch( $idb, 'some', IDBSSUBSTR ) ); +is_deeply( tcidbsearch2( $idb, 'some' ), [ 42, 65536 ], 'tcidbsearch2' ); + +ok( tcidbiterinit( $idb ), 'tcidbiterinit' ); + +my @ids; + +while ( my $id = tcidbiternext( $idb ) ) { + ok( $id, "tcidbiternext $id" ); + push @ids, $id; +} + +# order is not defined, so we need to sort it +is_deeply( [ sort @ids ], [ 42, 65536 ], 'all records' ); + +ok( tcidbsync( $idb ), 'tcidbsync' ); + +ok( tcidboptimize( $idb ), 'tcidboptimize' ); + +ok( tcidbvanish( $idb ), 'tcidbvanish' ); + diag tcidberrmsg( tcidbecode( $idb ) );