/[wait]/trunk/t/insert.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

Annotation of /trunk/t/insert.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88 - (hide annotations)
Mon May 24 13:44:01 2004 UTC (19 years, 11 months ago) by dpavlin
File MIME type: application/x-troff
File size: 2513 byte(s)
move cvs-head to trunk

1 ulpfr 10 # -*- Mode: Perl -*-
2     # database.t --
3     # ITIID : $ITI$ $Header $__Header$
4     # Author : Ulrich Pfeifer
5     # Created On : Thu Aug 8 12:14:23 1996
6     # Last Modified By: Ulrich Pfeifer
7     # Last Modified On: Sun Nov 22 18:44:30 1998
8     # Language : CPerl
9     # Update Count : 80
10     # Status : Unknown, Use with caution!
11     #
12     # Copyright (c) 1996-1997, Ulrich Pfeifer
13     #
14    
15     ######################### We start with some black magic to print on failure.
16    
17     BEGIN { $| = 1; print "1..18\n"; }
18     END {print "not ok 1\n" unless $loaded;
19     system 'rm -rf test' if -d 'test';
20     }
21     #use diagnostics;
22     use WAIT::Database;
23     $loaded = 1;
24     print "ok 1\n";
25    
26     ######################### End of black magic.
27    
28     $test = 2;
29    
30     $db = create WAIT::Database name => 'test';
31     print ((defined $db)? "ok $test\n" : "not ok $test\n"); $test++;
32    
33     $tb = create_table $db name => 'sample', attr => ['docid', 'term'];
34     print ((defined $tb)? "ok $test\n" : "not ok $test\n"); $test++;
35    
36     $tid = $tb->insert(docid => 1, term => IR);
37     print (($tid)? "ok $test\n" : "not ok $test\n"); $test++;
38    
39     $tb->sync;
40    
41     %tp = $tb->fetch($tid);
42     print (($tp{docid} == 1 and $tp{term} eq IR)? "ok $test\n" : "not ok $test\n"); $test++;
43    
44     $status = $tb->close;
45     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
46    
47     $status = $db->close;
48     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
49    
50     $db = WAIT::Database->open(name => 'test');
51     print ((defined $db)? "ok $test\n" : "not ok $test\n"); $test++;
52    
53     $tb = table $db name => 'sample';
54     print ((defined $tb)? "ok $test\n" : "not ok $test\n"); $test++;
55    
56     $status = $tb->open;
57     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
58    
59     %tp = $tb->fetch($tid);
60     print (($tp{docid} == 1 and $tp{term} eq IR)? "ok $test\n" : "not ok $test\n"); $test++;
61    
62     $status = $tb->delete(%tp);
63     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
64    
65     $status = $tb->delete_by_key($tid);
66     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
67    
68     # can we reuse tid?
69     $ntid = $tb->insert(docid => 1, term => IR);
70     print (($ntid == $tid)? "ok $test\n" : "not ok $test\n"); $test++;
71    
72     %tp = $tb->fetch($ntid);
73     print (($tp{docid} == 1 and $tp{term} eq IR)? "ok $test\n" : "not ok $test\n"); $test++;
74    
75     $status = $tb->close;
76     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
77    
78     # must have destroyed all handles here !
79     # clean up
80     $status = $db->dispose;
81     print (($status)? "ok $test\n" : "not ok $test\n"); $test++;
82     print ((!defined $db)? "ok $test\n" : "not ok $test\n"); $test++;
83    

Properties

Name Value
cvs2svn:cvs-rev 1.1

  ViewVC Help
Powered by ViewVC 1.1.26