blob: dd900c61babdab669c7146ffa1881571b65513b3 [file] [log] [blame]
David Reissbfc57a02009-03-30 20:46:37 +00001-module(test_membuffer).
2-export([t/0]).
3
4-include("thriftTest_types.hrl").
5
6test_data() ->
7 #xtruct{string_thing = <<"foobar">>,
8 byte_thing = 123,
9 i32_thing = 1234567,
10 i64_thing = 12345678900}.
11
12t1() ->
13 {ok, Transport} = thrift_memory_buffer:new(),
14 {ok, Protocol} = thrift_binary_protocol:new(Transport),
15 TestData = test_data(),
16 ok = thrift_protocol:write(Protocol,
17 {{struct, element(2, thriftTest_types:struct_info('xtruct'))},
18 TestData}),
19 {ok, Result} = thrift_protocol:read(Protocol,
20 {struct, element(2, thriftTest_types:struct_info('xtruct'))},
21 'xtruct'),
22
23 Result = TestData.
24
25
26t() ->
27 t1().
28