/[Search-TokyoDystopia]/t/10-xs.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

Contents of /t/10-xs.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (show annotations)
Mon Aug 18 18:32:55 2008 UTC (15 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1458 byte(s)
tcidbiterinit
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use blib;
7
8 use Test::More tests => 22;
9 use Test::Exception;
10 use Data::Dump qw/dump/;
11
12 BEGIN {
13 use_ok( 'Search::TokyoDystopia' );
14 }
15
16 my $path = 'casket';
17
18 cmp_ok( $Search::TokyoDystopia::debug, '==', 0, '$debug' );
19
20 cmp_ok( tcidberrmsg(0), 'eq', 'success', 'tcidberrmsg' );
21
22 ok( my $idb = tcidbnew, 'tcidbnew' ); # FIXME check better
23
24 ok( ! tcidbdel( $idb ), 'tcidbdel' );
25
26 ok( $idb = tcidbnew, 'tcidbnew again' );
27
28 is( tcidbecode( $idb ), 0, 'tcidbecode' );
29
30 ok( tcidbtune( $idb, 0, 0, 0, IDBTLARGE | IDBTDEFLATE ), 'tcidbtune' );
31
32 ok( tcidbsetcache( $idb, 0, 0 ), 'tcidbsetcache' );
33
34 ok( tcidbsetfwmmax( $idb, 0 ), 'tcidbsetfwmmax' );
35
36 ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path" );
37
38 ok( tcidbclose( $idb ), 'tcidbclose' );
39
40 ok( tcidbopen( $idb, $path, IDBOWRITER | IDBOCREAT ), "tcidbopen $path again" );
41
42 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 diag tcidberrmsg( tcidbecode( $idb ) );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26