comments
[libt2n] / example-codegen / client.cpp
CommitLineData
86c1c2e9
JT
1/***************************************************************************
2 * Copyright (C) 2004 by Intra2net AG *
3 * info@intra2net.com *
4 * *
5 ***************************************************************************/
6
7#include <socket_client.hxx>
8
7eb34f4d 9// include generated library headers
a96ab628
JT
10#include "default_client.hxx"
11#include "other_client.hxx"
86c1c2e9
JT
12
13int main(int argc, char** argv)
14{
15 libt2n::socket_client_connection sc("./socket");
29ba0e97 16 libt2n::socket_client_connection sc_other("./socket_other");
ae2e9f1b 17 cmd_group_default_client cc(sc);
29ba0e97 18 cmd_group_other_client cc_other(sc_other);
86c1c2e9 19
70e3d35c
JT
20 bool throwok=false;
21 try
22 {
23 cc.testfunc("throw");
24 }catch(libt2n::t2n_runtime_error &e){
25 throwok=(std::string(e.what())=="throw me around");
26 }
27
63291e4f
JT
28 Foo foo={10,10};
29
70e3d35c
JT
30 return ( throwok
31 && ( cc.testfunc("hello") == "hello, testfunc() was here" )
71ae912c
JT
32 && ( cc.testfunc_ref("hello") == "hello, testfunc() was here" )
33 && ( cc.t2(10) == 10 )
472456ca 34 && ( cc_other.t3(10, 20, "hello", std::pair<int, float>(10,20)) )
e5bc4700 35 && ( cc_other.t3(10) == 10 )
63291e4f
JT
36 && ( cc_other.t3(std::vector<int>(1,10)) )
37 && ( cc_other.t3(foo) ) )
71ae912c 38 ? EXIT_SUCCESS : EXIT_FAILURE;
86c1c2e9 39}