1 |
#!/usr/bin/perl |
2 |
use strict; |
3 |
use warnings; |
4 |
|
5 |
my $debug = shift @ARGV; |
6 |
|
7 |
use Test::More tests => 6; |
8 |
use Data::Dump qw/dump/; |
9 |
use lib 'lib'; |
10 |
|
11 |
BEGIN { |
12 |
use_ok('CWMP::Tree'); |
13 |
} |
14 |
|
15 |
#use Cwd qw/abs_path/; |
16 |
#ok(my $abs_path = abs_path($0), "abs_path"); |
17 |
#$abs_path =~ s!/[^/]*$!/!; #!fix-vim |
18 |
|
19 |
ok( my $obj = CWMP::Tree->new({ |
20 |
debug => $debug, |
21 |
}), 'new' ); |
22 |
isa_ok( $obj, 'CWMP::Tree' ); |
23 |
|
24 |
my @perl = qw/ |
25 |
{'InternetGatewayDevice'}->{'DeviceInfo'}->{'HardwareVersion'} |
26 |
{'InternetGatewayDevice'}->{'DeviceInfo'}->{'VendorConfigFile'}->[1]->{'Date'} |
27 |
{'InternetGatewayDevice'}->{'Services'}->{'VoiceService'}->[1]->{'PhyInterface'}->[2]->{'PhyPort'} |
28 |
/; |
29 |
|
30 |
foreach my $name ( qw/ |
31 |
InternetGatewayDevice.DeviceInfo.HardwareVersion |
32 |
InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date |
33 |
InternetGatewayDevice.Services.VoiceService.1.PhyInterface.2.PhyPort |
34 |
/ ) { |
35 |
my $expect = shift @perl; |
36 |
cmp_ok( $obj->name2perl( $name ), 'eq', $expect, "name2perl( $name )" ); |
37 |
} |