Array-LineReader
view release on metacpan or search on metacpan
t/10arrayref.t view on Meta::CPAN
ok(scalar(@rand),$testCount); # enough random numbers?
### Test if randomly choosen lines contain equal content ###
ok(tie(@lines, $TEST_CLASS, $TEST_FILE, result=>[]));
ok(join("",map{$lines[$_]->[0]}@rand),join("",map{$testOffsets[$_]}@rand)); # equal offsets
ok(join("",map{$lines[$_]->[1]}@rand),join("",map{$testLines[$_]}@rand)); # equal content
### Test if the offsets confirm the line`s lengths ###
push @testOffsets, $testOffsets[-1]+length($testLines[-1]); # offset of EOF
ok($testOffsets[-1],(stat($TEST_FILE))[7]); # EOF should be the file`s size
my $offs = 0;
ok(join("; ",0,map{ $offs += length($_->[1]) }@lines),join("; ",@testOffsets));
untie @lines;
### This is the last line of this testprogram. Don`t add anything behind it ###
t/20hashref.t view on Meta::CPAN
ok(scalar(@rand),$testCount); # enough random numbers?
### Test if randomly choosen lines contain equal content ###
ok(tie(@lines, $TEST_CLASS, $TEST_FILE, result=>{}));
ok(join("",map{$lines[$_]->{OFFSET}}@rand),join("",map{$testOffsets[$_]}@rand)); # equal offsets
ok(join("",map{$lines[$_]->{CONTENT}}@rand),join("",map{$testLines[$_]}@rand)); # equal content
### Test if the offsets confirm the line`s lengths ###
push @testOffsets, $testOffsets[-1]+length($testLines[-1]); # offset of EOF
ok($testOffsets[-1],(stat($TEST_FILE))[7]); # EOF should be the file`s size
my $offs = 0;
ok(join("; ",0,map{ $offs += length($_->{CONTENT}) }@lines),join("; ",@testOffsets));
untie @lines;
### This is the last line of this testprogram. Don`t add anything behind it ###
( run in 0.939 second using v1.01-cache-2.11-cpan-49f99fa48dc )