T Jake Luciani | 1952e54 | 2009-02-01 04:47:30 +0000 | [diff] [blame^] | 1 | use Test::More tests => 6; |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| 6 | use Data::Dumper; |
| 7 | |
| 8 | use Thrift::BinaryProtocol; |
| 9 | use Thrift::MemoryBuffer; |
| 10 | |
| 11 | use ThriftTest::Types; |
| 12 | |
| 13 | |
| 14 | my $transport = Thrift::MemoryBuffer->new(); |
| 15 | my $protocol = Thrift::BinaryProtocol->new($transport); |
| 16 | |
| 17 | my $a = ThriftTest::Xtruct->new(); |
| 18 | $a->i32_thing(10); |
| 19 | $a->i64_thing(30); |
| 20 | $a->string_thing('Hello, world!'); |
| 21 | $a->write($protocol); |
| 22 | |
| 23 | my $b = ThriftTest::Xtruct->new(); |
| 24 | $b->read($protocol); |
| 25 | is($b->i32_thing, $a->i32_thing); |
| 26 | is($b->i64_thing, $a->i64_thing); |
| 27 | is($b->string_thing, $a->string_thing); |
| 28 | |
| 29 | $b->write($protocol); |
| 30 | my $c = ThriftTest::Xtruct->new(); |
| 31 | $c->read($protocol); |
| 32 | is($c->i32_thing, $a->i32_thing); |
| 33 | is($c->i64_thing, $a->i64_thing); |
| 34 | is($c->string_thing, $a->string_thing); |