--- t/10-xs.t 2008/08/17 22:58:23 9 +++ t/10-xs.t 2008/08/18 17:45:56 17 @@ -5,7 +5,7 @@ use blib; -use Test::More tests => 10; +use Test::More tests => 18; use Test::Exception; use Data::Dump qw/dump/; @@ -13,21 +13,37 @@ use_ok( 'Search::TokyoDystopia' ); } +my $path = 'casket'; + cmp_ok( $Search::TokyoDystopia::debug, '==', 0, '$debug' ); -cmp_ok( Search::TokyoDystopia::errmsg(0), 'eq', 'success', 'errmsg' ); +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( my $db = Search::TokyoDystopia::new, 'new' ); # FIXME check better +ok( tcidbsetcache( $idb, 0, 0 ), 'tcidbsetcache' ); -ok( ! Search::TokyoDystopia::del( $db ), 'del' ); +ok( tcidbsetfwmmax( $idb, 0 ), 'tcidbsetfwmmax' ); -ok( $db = Search::TokyoDystopia::new, 'new again' ); +ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path" ); -is( Search::TokyoDystopia::ecode( $db ), 0, 'ecode' ); +ok( tcidbclose( $idb ), 'tcidbclose' ); -is( Search::TokyoDystopia::tune( $db, 0, 0, 0, 0 ), 1, 'tune' ); +ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path again" ); -is( Search::TokyoDystopia::setcache( $db, 0, 0 ), 1, 'setcache' ); +ok( tcidbput( $idb, 1, 'foobar' ), 'tcidbput' ); -is( Search::TokyoDystopia::setfwmmax( $db, 0 ), 1, 'setfwmmax' ); +ok( tcidbout( $idb, 1, ), 'tcidbout' ); +ok( tcidbput( $idb, 42, 'some data' ), 'tcidbput again' ); +is( tcidbget( $idb, 42 ), 'some data', 'tcidbget' ); +ok( ! tcidbget( $idb, 1 ), 'tcidbget non-existing' ); +diag tcidberrmsg( tcidbecode( $idb ) );