3 # Check FETCHSIZE and SETSIZE functions
4 # PUSH POP SHIFT UNSHIFT
16 print "ok $N\n"; $N++;
18 # 2-3 FETCHSIZE 0-length file
19 open F, "> $file" or die $!;
22 $o = tie @a, 'Tie::File', $file;
23 print $o ? "ok $N\n" : "not ok $N\n";
29 print $n == 0 ? "ok $N\n" : "not ok $N # $n, s/b 0\n";
36 my $data = "rec0$:rec1$:rec2$:";
37 open F, "> $file" or die $!;
42 $o = tie @a, 'Tie::File', $file;
43 print $o ? "ok $N\n" : "not ok $N\n";
46 # 4-5 FETCHSIZE positive-length file
48 print $n == 3 ? "ok $N\n" : "not ok $N # $n, s/b 0\n";
52 # (6-7) Make it longer:
55 check_contents("$data$:$:");
57 # (8-9) Make it longer again:
60 check_contents("$data$:$:$:$:");
62 # (10-11) Make it shorter:
65 check_contents("$data$:$:");
67 # (12-13) Make it shorter again:
70 check_contents($data);
72 # (14-15) Get rid of it completely:
77 # (16) 20020324 I have an idea that shortening the array will not
78 # expunge a cached record at the end if one is present.
84 print (! defined $r ? "ok $N\n" : "not ok $N \# was <$r>; should be UNDEF\n");
85 # Turns out not to be the case---STORESIZE explicitly removes them later
86 # 20020326 Well, but happily, this test did fail today.
88 # In the past, there was a bug in STORESIZE that it didn't correctly
89 # remove deleted records from the cache. This wasn't detected
90 # because these tests were all done with an empty cache. populate()
91 # will ensure that the cache is fully populated.
94 $z = $a[$_] for 0 .. $#a;
100 seek FH, 0, SEEK_SET;
102 { local $/; $a = <FH> }
103 $a = "" unless defined $a;
108 print "not ok $N\n# expected <$x>, got <$a>\n";
111 my $integrity = $o->_check_integrity($file, $ENV{INTEGRITY});
112 print $integrity ? "ok $N\n" : "not ok $N \# integrity\n";
127 1 while unlink $file;