From 71ae912ce0ade8f13cbffe0f105dad453f5e579f Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Tue, 21 Nov 2006 10:19:41 +0000 Subject: [PATCH] more complex test --- example-codegen/Makefile.am | 6 ++++-- example-codegen/client.cpp | 6 +++++- example-codegen/server.hxx | 28 +++++++++++++++++++++++++--- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index 4f80d48..dac66dc 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -14,8 +14,10 @@ noinst_PROGRAMS = client server codegen.stamp: server.hxx $(top_builddir)/codegen/codegen cp $(top_srcdir)/codegen/codegen-stubhead.hxx codegen_common.hxx - gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) server.hxx -fxml=tmpserver.xml - $(top_builddir)/codegen/codegen tmpserver.xml codegen_ + gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) server.hxx -fxml=server.xml + $(top_builddir)/codegen/codegen server.xml codegen_ touch codegen.stamp codegen_common.hxx codegen_common.cpp codegen_client.hxx codegen_client.cpp codegen_server.cpp: codegen.stamp + +TESTS = test diff --git a/example-codegen/client.cpp b/example-codegen/client.cpp index 6dee37e..10d2e52 100644 --- a/example-codegen/client.cpp +++ b/example-codegen/client.cpp @@ -14,5 +14,9 @@ int main(int argc, char** argv) libt2n::socket_client_connection sc("./socket"); cmd_group_default_client cc(sc); - return (cc.testfunc("hello")=="hello, testfunc() was here") ? EXIT_SUCCESS : EXIT_FAILURE; + return ( ( cc.testfunc("hello") == "hello, testfunc() was here" ) + && ( cc.testfunc_ref("hello") == "hello, testfunc() was here" ) + && ( cc.t2(10) == 10 ) + && ( cc.t3(10, 20, "hello", std::pair(10,20)) ) ) + ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/example-codegen/server.hxx b/example-codegen/server.hxx index 027e313..b20708b 100644 --- a/example-codegen/server.hxx +++ b/example-codegen/server.hxx @@ -1,13 +1,23 @@ #include #include "codegen_common.hxx" -using namespace std; - LIBT2N_SET_DEFAULTGROUP(example); LIBT2N_EXPORT std::string testfunc(std::string str) { - string ret; + std::string ret; + if (str=="throw") + throw libt2n::t2n_runtime_error("throw me around"); + if (str=="big") + ret.insert(0,100*1024,'x'); + else + ret=str+", testfunc() was here"; + return ret; +} + +LIBT2N_EXPORT std::string testfunc_ref(const std::string &str) +{ + std::string ret; if (str=="throw") throw libt2n::t2n_runtime_error("throw me around"); if (str=="big") @@ -16,3 +26,15 @@ LIBT2N_EXPORT std::string testfunc(std::string str) ret=str+", testfunc() was here"; return ret; } + +LIBT2N_EXPORT int t2(int i) +{ + return i; +} + +using namespace std; + +LIBT2N_EXPORT bool t3(int i, float f, const string &s, const pair &p) +{ + return (i==p.first) && (f==p.second) && (s=="hello"); +} -- 1.7.1