blob: a951a9ec3b2a008220c2f1e9666faedf804a73e0 [file] [log] [blame]
Mark Slee3f14d3e2007-12-05 23:13:11 +00001#!/usr/bin/env ruby
2
3$:.push('gen-rb')
4$:.push('../../lib/rb/lib')
5
6require 'thrift/transport/tsocket'
7require 'thrift/protocol/tbinaryprotocol'
8require 'ThriftTest'
9
10t = TFramedTransport.new(TSocket.new('localhost', 9090))
11p = TBinaryProtocol.new(t)
12c = Thrift::Test::ThriftTest::Client.new(p)
13
14t.open()
15
16puts c.testString('string')
17puts c.testByte(8)
18puts c.testByte(-8)
19puts c.testI32(32)
20puts c.testI32(-32)
21puts c.testI64(64)
22puts c.testI64(-64)
23puts c.testDouble(3.14)
24puts c.testDouble(-3.14)
25puts c.testMap({1 => 1, 2 => 2, 3 => 3})
26puts c.testList([1,2,3,4,5])
27puts c.testSet({1 => true, 2 => true, 3 => true})
28struct = Thrift::Test::Xtruct.new({'string_thing' => 'hi!', 'i32_thing' => 4 })
29puts c.testStruct(struct)
30puts c.testNest(Thrift::Test::Xtruct2.new({'struct_thing' => struct, 'i32_thing' => 10}))
31insane = Thrift::Test::Insanity.new({'userMap' => { Thrift::Test::Numberz::ONE => 44 }, 'xtructs' => [struct, Thrift::Test::Xtruct.new({'string_thing' => 'hi again', 'i32_thing' => 12})]})
32puts c.testInsanity(insane)
33puts c.testMapMap(4).inspect
34
35t.close()