summaryrefslogtreecommitdiff
path: root/t/boolean-roundtrip.t
blob: cddb25117ef56d65afd995b151445ddc478d7d38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use warnings;
use Test::More;
use Data::MessagePack::Stream;

my $stream = Data::MessagePack::Stream->new;

$stream->feed("\xc3"); # the serialization of boolean "true"
$stream->feed("\xc2"); # the serialization of boolean "false"

ok $stream->next, 'next ok';
my $t = $stream->data;
is(0+$t, 1);
is("$t", "true");
is(ref($t), "Data::MessagePack::Boolean");

ok $stream->next, 'next ok';
$t = $stream->data;
is(0+$t, 0);
is("$t", "false");
is(ref($t), "Data::MessagePack::Boolean");

done_testing;