--- t/10-xs.t 2008/08/17 22:27:23 3 +++ t/10-xs.t 2008/08/18 17:26:01 15 @@ -5,7 +5,7 @@ use blib; -use Test::More tests => 5; +use Test::More tests => 15; use Test::Exception; use Data::Dump qw/dump/; @@ -13,10 +13,34 @@ use_ok( 'Search::TokyoDystopia' ); } +my $path = 'casket'; + cmp_ok( $Search::TokyoDystopia::debug, '==', 0, '$debug' ); -cmp_ok( Search::TokyoDystopia::tcidberrmsg(0), 'eq', 'success', 'tcidberrmsg' ); +cmp_ok( tcidberrmsg(0), 'eq', 'success', 'tcidberrmsg' ); + +ok( my $idb = tcidbnew, 'tcidbnew' ); # FIXME check better + +ok( ! tcidbdel( $idb ), 'tcidbdel' ); + +ok( $idb = tcidbnew, 'tcidbnew again' ); + +is( tcidbecode( $idb ), 0, 'tcidbecode' ); + +ok( tcidbtune( $idb, 0, 0, 0, IDBTLARGE | IDBTDEFLATE ), 'tcidbtune' ); + +ok( tcidbsetcache( $idb, 0, 0 ), 'tcidbsetcache' ); + +ok( tcidbsetfwmmax( $idb, 0 ), 'tcidbsetfwmmax' ); + +ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path" ); + +ok( tcidbclose( $idb ), 'tcidbclose' ); + +ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path again" ); + +ok( tcidbput( $idb, 1, 'foobar' ), 'tcidbput' ); -ok( my $db = Search::TokyoDystopia::tcidbnew, 'tcidbnew' ); # FIXME check better +ok( tcidbout( $idb, 1, ), 'tcidbout' ); -ok( ! Search::TokyoDystopia::tcidbdel( $db ), 'tcidbdel' ); +diag tcidberrmsg( tcidbecode( $idb ) );