Mark Slee | 02d1edc | 2007-03-07 05:17:25 +0000 | [diff] [blame] | 1 | #!/usr/bin/env ruby |
Mark Slee | 6d7d595 | 2007-01-27 01:44:22 +0000 | [diff] [blame] | 2 | |
| 3 | $:.push('gen-rb') |
Mark Slee | 157d9f7 | 2007-02-07 06:03:53 +0000 | [diff] [blame] | 4 | $:.push('../../lib/rb/lib') |
Mark Slee | 6d7d595 | 2007-01-27 01:44:22 +0000 | [diff] [blame] | 5 | |
| 6 | require 'thrift/transport/tsocket' |
| 7 | require 'thrift/protocol/tbinaryprotocol' |
| 8 | require 'ThriftTest' |
| 9 | |
| 10 | s = TSocket.new('localhost', 9090) |
| 11 | p = TBinaryProtocol.new(s) |
| 12 | c = ThriftTest::Client.new(p) |
| 13 | |
| 14 | s.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 | |
Mark Slee | 477a580 | 2007-06-30 01:18:12 +0000 | [diff] [blame^] | 29 | struct = Xtruct.new({'string_thing' => 'hi!', 'i32_thing' => 4 }) |
| 30 | puts c.testStruct(struct) |
| 31 | puts c.testNest(Xtruct2.new({'struct_thing' => struct, 'i32_thing' => 10})) |
| 32 | |
Mark Slee | 6d7d595 | 2007-01-27 01:44:22 +0000 | [diff] [blame] | 33 | s.close() |
| 34 | |
| 35 | |