iproctor | ff8eb92 | 2007-07-25 19:06:13 +0000 | [diff] [blame] | 1 | module Client where |
| 2 | import Thrift |
| 3 | import ThriftTest_Client |
| 4 | import ThriftTest_Types |
| 5 | import TSocket |
| 6 | import TBinaryProtocol |
| 7 | import qualified Data.Map as Map |
| 8 | import qualified Data.Set as Set |
| 9 | import Control.Monad |
| 10 | t = TSocket "127.0.0.1" 9090 Nothing |
| 11 | |
| 12 | main = do to <- topen t |
| 13 | let p = TBinaryProtocol to |
| 14 | let ps = (p,p) |
| 15 | print =<< testString ps "bya" |
| 16 | print =<< testByte ps 8 |
| 17 | print =<< testByte ps (-8) |
| 18 | print =<< testI32 ps 32 |
| 19 | print =<< testI32 ps (-32) |
| 20 | print =<< testI64 ps 64 |
| 21 | print =<< testI64 ps (-64) |
| 22 | print =<< testDouble ps 3.14 |
| 23 | print =<< testDouble ps (-3.14) |
| 24 | print =<< testMap ps (Map.fromList [(1,1),(2,2),(3,3)]) |
| 25 | print =<< testList ps [1,2,3,4,5] |
| 26 | print =<< testSet ps (Set.fromList [1,2,3,4,5]) |
| 27 | print =<< testStruct ps (Xtruct (Just "hi") (Just 4) (Just 5) Nothing) |
| 28 | tclose to |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 29 | |