1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 1.t'
#########################
use strict;
use Test;
BEGIN { plan tests => 12 }
#########################
use FindBin;
use X12::Parser::Cf;
#setup
my $sample_cf = "$FindBin::RealBin/../cf/837_004010X098.cf";
my $cf = X12::Parser::Cf->new();
my $root = $cf->load( file => $sample_cf );
my ( $svalue, $ivalue, $node, $array );
#test
$ivalue = $root->get_child_count;
ok( $ivalue, 11 );
#test
$svalue = $root->get_name;
ok( $svalue, 'X12' );
#test
$node = $root->get_child(7);
$svalue = $node->get_name;
ok( $svalue, '2000C' );
#test
$ivalue = $node->get_child_count;
ok( $ivalue, 2 );
#test
$svalue = $node->{_SEG};
ok( $svalue, 'HL' );
#test
$ivalue = $node->{_SEG_QUAL_POS};
ok( $ivalue, 3 );
#test
$array = $node->{_SEG_QUAL};
ok( @{$array}[0], '23' );
#test
$node = $node->get_child(1);
$svalue = $node->get_name;
ok( $svalue, '2300' );
#test
$ivalue = $node->get_child_count;
ok( $ivalue, 8 );
#test
$node = $node->get_child(7);
$svalue = $node->get_name;
ok( $svalue, '2400' );
#test
$ivalue = $node->get_child_count;
ok( $ivalue, 9 );
#test
$ivalue = $node->get_depth;
ok( $ivalue, 3 );
|