ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/t/57_incr.t
(Generate patch)

Comparing CBOR-XS/t/57_incr.t (file contents):
Revision 1.1 by root, Tue Dec 10 13:54:40 2013 UTC vs.
Revision 1.2 by root, Tue Dec 10 14:01:53 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines