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