/[Search-TokyoDystopia]/t/12-tcj.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

Diff of /t/12-tcj.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 37 by dpavlin, Sun Sep 21 20:16:39 2008 UTC revision 40 by dpavlin, Sat Feb 14 17:36:46 2009 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  use blib;  use blib;
7    
8  use Test::More tests => 30;  use Test::More tests => 32;
9  use Test::Exception;  use Test::Exception;
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
11    
# Line 35  ok( tcjdbsetfwmmax( $jdb, 0 ), 'tcjdbset Line 35  ok( tcjdbsetfwmmax( $jdb, 0 ), 'tcjdbset
35    
36  ok( tcjdbopen( $jdb, $path, JDBOWRITER | JDBOCREAT | JDBOTRUNC ), "tcjdbopen $path" );  ok( tcjdbopen( $jdb, $path, JDBOWRITER | JDBOCREAT | JDBOTRUNC ), "tcjdbopen $path" );
37    
38  ok( tcjdbclose( $jdb ), 'tcjdbclose' );  SKIP: {
39  diag tcjdberrmsg( tcjdbecode( $jdb ) );          skip 'close on empty database makes next open segfault', 2;
40    
41  ok( tcjdbopen( $jdb, $path, JDBOWRITER | JDBOCREAT ), "tcjdbopen $path again" );          ok( tcjdbclose( $jdb ), 'tcjdbclose' );
42  diag tcjdberrmsg( tcjdbecode( $jdb ) );  
43            ok( tcjdbopen( $jdb, $path, JDBOWRITER | JDBOCREAT ), "tcjdbopen $path again" );
44    
45    }
46    
47  ok( tcjdbput( $jdb, 1, [ 'foobar' ] ), 'tcjdbput' );  ok( tcjdbput( $jdb, 1, [ 'foobar' ] ), 'tcjdbput' );
 diag tcjdberrmsg( tcjdbecode( $jdb ) );  
48    
49  ok( tcjdbout( $jdb, 1 ), 'tcjdbout' );  ok( tcjdbout( $jdb, 1 ), 'tcjdbout' );
50    
# Line 50  ok( tcjdbput( $jdb, 42, [ 'some', 'data' Line 52  ok( tcjdbput( $jdb, 42, [ 'some', 'data'
52    
53  ok( tcjdbput2( $jdb, 99, 'some more data again', ' ' ), 'tcjdbput2' );  ok( tcjdbput2( $jdb, 99, 'some more data again', ' ' ), 'tcjdbput2' );
54    
55  is_deeply( tcjdbsearch( $jdb, 'some', JDBSSUBSTR ), [ 42 ], 'tcjdbsearch' );  is_deeply( tcjdbsearch( $jdb, 'some', JDBSFULL ), [ 42, 99 ], 'tcjdbsearch' );
56    is_deeply( tcjdbsearch2( $jdb, 'some' ), [ 42, 99 ], 'tcjdbsearch2' );
57    
58  ok( tcjdbput( $jdb, 65536, [ 'some', 'more', 'data' ] ), 'tcjdbput more data' );  ok( tcjdbput( $jdb, 65536, [ 'some', 'more', 'data' ] ), 'tcjdbput more data' );
59  is_deeply( tcjdbsearch( $jdb, 'some', JDBSSUBSTR ), [ 42, 65536 ], 'tcjdbsearch' );  is_deeply( tcjdbsearch( $jdb, 'some', JDBSFULL ), [ 42, 99, 65536 ], 'tcjdbsearch' );
60    is_deeply( tcjdbsearch2( $jdb, 'some' ), [ 42, 99, 65536 ], 'tcjdbsearch2' );
61    
62  ok( tcjdbsync( $jdb ), 'tcjdbsync' );  ok( tcjdbsync( $jdb ), 'tcjdbsync' );
63    
# Line 65  ok( -e $copy_path, 'copy exists' ); Line 70  ok( -e $copy_path, 'copy exists' );
70    
71  is( tcjdbpath( $jdb ), $path, 'tcjdbpath' );  is( tcjdbpath( $jdb ), $path, 'tcjdbpath' );
72    
73  is( tcjdbtnum( $jdb ), 13, 'tcjdbtnum' );  is( tcjdbrnum( $jdb ), 3, 'tcjdbrnum' );
74    
75  ok( my $file_size = tcjdbfsiz( $jdb ), 'tcjdbfsiz' );  ok( my $file_size = tcjdbfsiz( $jdb ), 'tcjdbfsiz' );
76    

Legend:
Removed from v.37  
changed lines
  Added in v.40

  ViewVC Help
Powered by ViewVC 1.1.26