#
# Check FETCHSIZE and SETSIZE functions
# PUSH POP SHIFT UNSHIFT
#
use POSIX 'SEEK_SET';
my $file = "tf$$.txt";
my $data = "rec0blahrec1blahrec2blah";
my ($o, $n);
print "1..10\n";
my $N = 1;
print "ok $N\n"; $N++;
# 2-3 FETCHSIZE 0-length file
close F;
print $o ? "ok $N\n" : "not ok $N\n";
$N++;
$n = @a;
print $n == 0 ? "ok $N\n" : "not ok $N # $n, s/b 0\n";
$N++;
# Reset everything
undef $o;
untie @a;
# 4-5 FETCHSIZE positive-length file
print F $data;
close F;
print $o ? "ok $N\n" : "not ok $N\n";
$N++;
$n = @a;
print $n == 3 ? "ok $N\n" : "not ok $N # $n, s/b 0\n";
$N++;
# STORESIZE
# 6 Make it longer:
$#a = 4;
# 7 Make it longer again:
$#a = 6;
# 8 Make it shorter:
$#a = 4;
# 9 Make it shorter again:
$#a = 2;
# 10 Get rid of it completely:
$#a = -1;
my $x = shift;
my $a;
{ local $/; $a = <FH> }
print "ok $N\n";
} else {
}
$N++;
}
sub ctrlfix {
for (@_) {
s/\n/\\n/g;
s/\r/\\r/g;
}
}
END {
undef $o;
untie @a;
}