1use Test::Base;
2
3plan tests => 1 * blocks;
4
5use FindBin;
6use File::Spec;
7
8use Data::AMF;
9use Data::AMF::Type::Boolean;
10use Data::AMF::Type::Null;
11
12my $amf = Data::AMF->new( version => 3 );
13
14sub load {
15    my $file = File::Spec->catfile( $FindBin::Bin, $_[0] );
16    open my $fh, "<$file";
17    my $data = do { local $/; <$fh> };
18    close $fh;
19
20    $data;
21}
22
23sub parse {
24    my ($obj) = $amf->deserialize($_[0]);
25
26    return $obj;
27}
28
29filters {
30    input    => [qw/load parse/],
31    expected => 'eval',
32};
33
34run_compare;
35
36__DATA__
37
38=== number
39--- input: data/amf3/number
40--- expected
41123.45
42
43=== boolean true
44--- input: data/amf3/true
45--- expected
46Data::AMF::Type::Boolean->new(1)
47
48=== boolean false
49--- input: data/amf3/false
50--- expected
51Data::AMF::Type::Boolean->new(0)
52
53=== string
54--- input: data/amf3/string
55--- expected
56"foo"
57
58=== object
59--- input: data/amf3/object
60--- expected
61{ foo => "bar" }
62
63=== object2
64--- input: data/amf3/object2
65--- expected
66{
67	array => [ "foo", "bar" ],
68	hash => { foo => "bar" }
69}
70
71=== null object
72--- input: data/amf3/null_object
73--- expected
74{}
75
76=== array
77--- input: data/amf3/array
78--- expected
79[ "foo", "bar" ]
80
81=== null
82--- input: data/amf3/null
83--- expected
84Data::AMF::Type::Null->new()
85
86=== undefined
87--- input: data/amf3/undefined
88--- expected
89undef
90
91=== date
92--- input: data/amf3/date
93--- expected
94DateTime->new(
95	year   => 2009,
96	month  => 10,
97	day    => 22,
98	hour   => 03,
99	minute => 34,
100	second => 56
101)
102
103=== byte_array
104--- input: data/amf3/byte_array
105--- expected
106Data::AMF::Type::ByteArray->new([10, 11, 1, 7, 102, 111, 111, 6, 7, 98, 97, 114, 1])
107