/[Search-TokyoDystopia]/t/11-tcq.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/11-tcq.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Tue Sep 9 13:17:16 2008 UTC (15 years, 6 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1906 byte(s)
fix tcqdbtnum
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use blib;
7
8 use Test::More tests => 30;
9 use Test::Exception;
10 use Data::Dump qw/dump/;
11
12 BEGIN {
13 use_ok( 'Search::TokyoDystopia' );
14 }
15
16 my $path = 'casket-q';
17
18 cmp_ok( $Search::TokyoDystopia::debug, '==', 0, '$debug' );
19
20 ok( my $tdversion = tdversion, 'tdversion' );
21 diag "tdversion: $tdversion";
22
23 cmp_ok( tcqdberrmsg(0), 'eq', 'success', 'tcqdberrmsg' );
24
25 ok( my $qdb = tcqdbnew, 'tcqdbnew' ); # FIXME check better
26
27 ok( ! tcqdbdel( $qdb ), 'tcqdbdel' );
28
29 ok( $qdb = tcqdbnew, 'tcqdbnew again' );
30
31 is( tcqdbecode( $qdb ), 0, 'tcqdbecode' );
32
33 ok( tcqdbtune( $qdb, 0, QDBTLARGE | QDBTDEFLATE ), 'tcqdbtune' );
34
35 ok( tcqdbsetcache( $qdb, 0, 0 ), 'tcqdbsetcache' );
36
37 ok( tcqdbsetfwmmax( $qdb, 0 ), 'tcqdbsetfwmmax' );
38
39 ok( tcqdbopen( $qdb, $path, QDBOWRITER | QDBOCREAT | QDBOTRUNC ), "tcqdbopen $path" );
40
41 ok( tcqdbclose( $qdb ), 'tcqdbclose' );
42
43 ok( tcqdbopen( $qdb, $path, QDBOWRITER | QDBOCREAT ), "tcqdbopen $path again" );
44
45 ok( tcqdbput( $qdb, 1, 'foobar' ), 'tcqdbput' );
46
47 ok( tcqdbout( $qdb, 1, 'foobar' ), 'tcqdbout' );
48
49 ok( tcqdbput( $qdb, 42, 'some data' ), 'tcqdbput again' );
50
51 is_deeply( tcqdbsearch( $qdb, 'some', QDBSSUBSTR ), [ 42 ], 'tcqdbsearch' );
52 ok( tcqdbput( $qdb, 65536, 'some more data' ), 'tcqdbput more data' );
53 is_deeply( tcqdbsearch( $qdb, 'some', QDBSSUBSTR ), [ 42, 65536 ], 'tcqdbsearch' );
54
55 ok( tcqdbsync( $qdb ), 'tcqdbsync' );
56
57 ok( tcqdboptimize( $qdb ), 'tcqdboptimize' );
58
59 my $copy_path = $path . '-copy';
60
61 ok( tcqdbcopy( $qdb, $copy_path ), "tcqdbcopy $copy_path" );
62 ok( -e $copy_path, 'copy exists' );
63
64 is( tcqdbpath( $qdb ), $path, 'tcqdbpath' );
65
66 is( tcqdbtnum( $qdb ), 13, 'tcqdbtnum' );
67
68 ok( my $file_size = tcqdbfsiz( $qdb ), 'tcqdbfsiz' );
69
70 ok( tcqdbvanish( $qdb ), 'tcqdbvanish' );
71
72 is( tcqdbtnum( $qdb ), 0, 'tcqdbtnum' );
73
74 cmp_ok( tcqdbfsiz( $qdb ), '<=', $file_size, 'tcqdbfsiz' );
75
76 diag tcqdberrmsg( tcqdbecode( $qdb ) );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26