… | |
… | |
6 | my $tst = 1; |
6 | my $tst = 1; |
7 | |
7 | |
8 | sub tst($$) { |
8 | sub tst($$) { |
9 | my ($cbor, $correct) = @_; |
9 | my ($cbor, $correct) = @_; |
10 | |
10 | |
|
|
11 | my $dec = CBOR::XS->new; |
|
|
12 | |
11 | # chop |
13 | # chop |
12 | for my $step (1 .. length $cbor) { |
14 | for my $step (1 .. length $cbor) { |
13 | my $dec = CBOR::XS->new; |
|
|
14 | my $buf = ""; |
15 | my $buf = ""; |
15 | my @cbor; |
16 | my @cbor; |
16 | |
17 | |
|
|
18 | $dec->incr_reset; |
|
|
19 | |
17 | for (unpack "(a$step)*", $cbor) { |
20 | for (unpack "(a$step)*", $cbor) { |
18 | $buf .= $_; |
21 | $buf .= $_; |
19 | push @cbor, $dec->incr_parse ($buf); |
22 | push @cbor, $dec->incr_parse_multiple ($buf); |
20 | } |
23 | } |
21 | |
24 | |
22 | print length $buf ? "not " : "", "ok ", ++$tst, "\n"; |
25 | print length $buf ? "not " : "", "ok ", ++$tst, "\n"; |
23 | |
26 | |
24 | my $enc = join " ", map +(unpack "H*", encode_cbor $_), @cbor; |
27 | my $enc = join " ", map +(unpack "H*", encode_cbor $_), @cbor; |