1 |
# -*- Mode: Perl -*- |
2 |
# document-split.t -- |
3 |
# ITIID : $ITI$ $Header $__Header$ |
4 |
# Author : Ulrich Pfeifer |
5 |
# Created On : Sun Sep 15 17:10:53 1996 |
6 |
# Last Modified By: Ulrich Pfeifer |
7 |
# Last Modified On: Sun Nov 22 18:44:32 1998 |
8 |
# Language : CPerl |
9 |
# Update Count : 22 |
10 |
# Status : Unknown, Use with caution! |
11 |
# |
12 |
# Copyright (c) 1996-1997, Ulrich Pfeifer |
13 |
# |
14 |
|
15 |
BEGIN { $| = 1; print "1..8\n"; } |
16 |
END {print "not ok 1\n" unless $loaded;} |
17 |
use WAIT::Document::Split; |
18 |
$loaded = 1; |
19 |
print "ok 1\n"; |
20 |
|
21 |
$test = 2; |
22 |
|
23 |
my %D; |
24 |
my $x = tie %D, WAIT::Document::Split, 'sep', '\f', 't/test.ste'; |
25 |
print ((defined $x)? "ok $test\n" : "not ok $test\n"); $test++; |
26 |
print ((scalar(keys %D) == 16)? "ok $test\n" : "not ok $test\n"); $test++; |
27 |
my $f = $x->FIRSTKEY; |
28 |
my($start, $len) = ($f =~ /(\d+) (\d+)/); |
29 |
print (($start == 0)? "ok $test\n" : "not ok $test\n"); $test++; |
30 |
|
31 |
undef $x; |
32 |
untie %D; |
33 |
|
34 |
my $y = tie %D, WAIT::Document::Split, 'end', '\f', 't/test.ste'; |
35 |
print ((defined $y)? "ok $test\n" : "not ok $test\n"); $test++; |
36 |
|
37 |
$f = $y->FIRSTKEY; |
38 |
my ($nlen) = ($f =~ /(\d+)$/); |
39 |
print (($nlen == $len+2)? "ok $test\n" : "not ok $test\n"); $test++; |
40 |
|
41 |
$f = $y->NEXTKEY; |
42 |
($start) = ($f =~ /(\d+) \d+$/); |
43 |
|
44 |
undef $y; |
45 |
untie %D; |
46 |
$y = tie %D, WAIT::Document::Split, 'start', '\f', 't/test.ste'; |
47 |
print ((defined $y)? "ok $test\n" : "not ok $test\n"); $test++; |
48 |
$f = $y->FIRSTKEY; |
49 |
$f = $y->NEXTKEY; |
50 |
my ($nstart) = ($f =~ /(\d+) \d+$/); |
51 |
print (($nstart == $start-2)? "ok $test\n" : "not ok $test\n"); $test++; |
52 |
|
53 |
|