File: 12_stream_unpack4.t

package info (click to toggle)
libdata-messagepack-perl 1.02-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,060 kB
  • sloc: ansic: 5,697; perl: 1,123; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 554 bytes parent folder | download | duplicates (7)
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
use strict;
use warnings;
use Data::MessagePack;
use Test::More;
use t::Util;

my @input = (
    [[]],
    [[],[]],
    [{"a" => 97},{"a" => 97}],
    [{"a" => 97},{"a" => 97},{"a" => 97}],
    [ map { +{ "foo $_" => "bar $_" } } 'aa' .. 'zz' ],
    [42, null],
    [42, true],
    [42, false],
);

plan tests => @input * 2;

for my $input (@input) {
    my $packed = Data::MessagePack->pack($input);
    my $up = Data::MessagePack::Unpacker->new();
    $up->execute($packed, 0);
    ok $up->is_finished, 'finished';
    is_deeply($up->data, $input);
}