[r419]: / trunk / t / SOAP / Lite / Deserializer / XMLSchema1999.t  Maximize  Restore  History

Download this file

54 lines (41 with data), 1.7 kB

 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
use Test::More;
plan tests => 42;
use_ok qw(SOAP::Lite::Deserializer::XMLSchema1999);
is SOAP::Lite::Deserializer::XMLSchema1999->anyTypeValue(),
'ur-type',
'anyTypeValue';
is SOAP::Lite::Deserializer::XMLSchema1999->as_boolean('false'),
0, 'as_boolean("false")';
is SOAP::Lite::Deserializer::XMLSchema1999->as_boolean('true'),
1, 'as_boolean("false")';
eval {SOAP::Lite::Deserializer::XMLSchema1999->as_boolean('foobar') };
ok $@, 'died on illegal boolean value';
undef $@;
is ord SOAP::Lite::Deserializer::XMLSchema1999->as_hex('FF'),
255, 'as_hex(FF)';
is ord SOAP::Lite::Deserializer::XMLSchema1999->as_hex('65'),
101, 'as_hex(65)';
is SOAP::Lite::Deserializer::XMLSchema1999->as_hex('4142'),
'AB', 'as_hex(4142)';
is SOAP::Lite::Deserializer::XMLSchema1999->as_ur_type('4242'),
'4242', 'as_ur_type(4242)';
is SOAP::Lite::Deserializer::XMLSchema1999->as_undef('true'),
'1', 'as_undef("true")';
is SOAP::Lite::Deserializer::XMLSchema1999->as_undef('false'),
'0', 'as_undef("false")';
eval {SOAP::XMLSchema1999::Deserializer->as_undef('ZUMSL')};
ok $@, 'died on illegal nil value';
undef $@;
for (qw(
string
float double decimal
timeDuration recurringDuration uriReference
integer nonPositiveInteger negativeInteger long int short byte
nonNegativeInteger unsignedLong unsignedInt unsignedShort unsignedByte
positiveInteger timeInstant time timePeriod date month year century
recurringDate recurringDay language) ) {
no strict qw(refs);
my $method = "as_$_";
is SOAP::Lite::Deserializer::XMLSchema1999->$method('something nice'),
'something nice', "$method('something nice')";
}