1N/A# Check PUSH, POP, SHIFT, and UNSHIFT 1N/A# Each call to 'check_contents' actually performs two tests. 1N/A# First, it calls the tied object's own 'check_integrity' method, 1N/A# which makes sure that the contents of the read cache and offset tables 1N/A# accurately reflect the contents of the file. 1N/A# Then, it checks the actual contents of the file against the expected 1N/Aprint "ok $N\n"; $N++;
# partial credit just for showing up 1N/Aprint $o ?
"ok $N\n" :
"not ok $N\n";
1N/A$n =
push @a,
"rec0",
"rec1",
"rec2";
1N/Aprint $n ==
3 ?
"ok $N\n" :
"not ok $N # size is $n, should be 3\n";
1N/Aprint $n ==
5 ?
"ok $N\n" :
"not ok $N # size is $n, should be 5\n";
1N/Aprint $n ==
5 ?
"ok $N\n" :
"not ok $N # size is $n, should be 5\n";
1N/Aprint $n
eq "rec4$:" ?
"ok $N\n" :
"not ok $N # last rec is $n, should be rec4\n";
1N/A# Presumably we have already tested this to death 1N/Aprint $n
eq "rec0$:" ?
"ok $N\n" :
"not ok $N # last rec is $n, should be rec0\n";
1N/Aprint !
defined $n ?
"ok $N\n" :
"not ok $N # last rec should be undef, is $n\n";
1N/A# (21-29) UNSHIFT tests 1N/Aprint $n ==
3 ?
"ok $N\n" :
"not ok $N # size is $n, should be 3\n";
1N/Aprint $n ==
5 ?
"ok $N\n" :
"not ok $N # size is $n, should be 5\n";
1N/Aprint $n ==
5 ?
"ok $N\n" :
"not ok $N # size is $n, should be 5\n";
1N/A# (30-38) SHIFT tests 1N/Aprint $n
eq "rec3$:" ?
"ok $N\n" :
"not ok $N # last rec is $n, should be rec3\n";
1N/A# Presumably we have already tested this to death 1N/Aprint $n
eq "rec4$:" ?
"ok $N\n" :
"not ok $N # last rec is $n, should be rec4\n";
1N/Aprint !
defined $n ?
"ok $N\n" :
"not ok $N # last rec should be undef, is $n\n";