From bf27a8a5282dab443335d8a8ab62cdf8fe1f6a95 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:06:17 +0900 Subject: Windows version of the tests implemented Signed-off-by: Martin Sustrik --- tests/pair_ipc.cpp | 9 ++++ tests/reqrep_ipc.cpp | 9 ++++ tests/shutdown_stress.cpp | 9 ++++ tests/tests.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++++++ tests/timeo.cpp | 8 ++++ 5 files changed, 155 insertions(+) create mode 100644 tests/tests.cpp (limited to 'tests') diff --git a/tests/pair_ipc.cpp b/tests/pair_ipc.cpp index c9dd5ae..ad58798 100644 --- a/tests/pair_ipc.cpp +++ b/tests/pair_ipc.cpp @@ -20,6 +20,13 @@ #include "testutil.hpp" +#if defined XS_HAVE_WINDOWS +int XS_TEST_MAIN () +{ + return 0; +} +#else + int XS_TEST_MAIN () { fprintf (stderr, "pair_ipc test running...\n"); @@ -50,3 +57,5 @@ int XS_TEST_MAIN () return 0 ; } + +#endif diff --git a/tests/reqrep_ipc.cpp b/tests/reqrep_ipc.cpp index 3d1092e..1718c62 100644 --- a/tests/reqrep_ipc.cpp +++ b/tests/reqrep_ipc.cpp @@ -20,6 +20,13 @@ #include "testutil.hpp" +#if defined XS_HAVE_WINDOWS +int XS_TEST_MAIN () +{ + return 0; +} +#else + int XS_TEST_MAIN () { fprintf (stderr, "reqrep_ipc test running...\n"); @@ -50,3 +57,5 @@ int XS_TEST_MAIN () return 0 ; } + +#endif \ No newline at end of file diff --git a/tests/shutdown_stress.cpp b/tests/shutdown_stress.cpp index d0156ff..2e6b4d5 100644 --- a/tests/shutdown_stress.cpp +++ b/tests/shutdown_stress.cpp @@ -21,6 +21,13 @@ #include "testutil.hpp" +#if defined XS_HAVE_WINDOWS +int XS_TEST_MAIN () +{ + return 0; +} +#else + #include #include @@ -88,3 +95,5 @@ int XS_TEST_MAIN () return 0; } + +#endif \ No newline at end of file diff --git a/tests/tests.cpp b/tests/tests.cpp new file mode 100644 index 0000000..dc55e97 --- /dev/null +++ b/tests/tests.cpp @@ -0,0 +1,120 @@ +/* + Copyright (c) 2012 250bpm s.r.o. + Copyright (c) 2012 Other contributors as noted in the AUTHORS file + + This file is part of Crossroads project. + + Crossroads is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Crossroads is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +// This file is used only in MSVC build. +// It gathers all the tests into a single executable. + +#include + +#define XS_TEST_MAIN hwm +#include "hwm.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN invalid_rep +#include "invalid_rep.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN linger +#include "linger.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN msg_flags +#include "msg_flags.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN pair_inproc +#include "pair_inproc.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN pair_ipc +#include "pair_ipc.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN pair_tcp +#include "pair_tcp.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN reconnect +#include "reconnect.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN reqrep_device +#include "reqrep_device.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN reqrep_inproc +#include "reqrep_inproc.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN reqrep_ipc +#include "reqrep_ipc.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN reqrep_tcp +#include "reqrep_tcp.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN shutdown_stress +#include "shutdown_stress.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN sub_forward +#include "sub_forward.cpp" +#undef XS_TEST_MAIN + +#define XS_TEST_MAIN timeo +#include "timeo.cpp" +#undef XS_TEST_MAIN + +int main () +{ + int rc; + + rc = hwm (); + assert (rc == 0); + rc = invalid_rep (); + assert (rc == 0); + rc = linger (); + assert (rc == 0); + rc = msg_flags (); + assert (rc == 0); + rc = pair_inproc (); + assert (rc == 0); + rc = pair_ipc (); + assert (rc == 0); + rc = reconnect (); + assert (rc == 0); + rc = reqrep_device (); + assert (rc == 0); + rc = reqrep_inproc (); + assert (rc == 0); + rc = reqrep_ipc (); + assert (rc == 0); + rc = reqrep_tcp (); + assert (rc == 0); + rc = shutdown_stress (); + assert (rc == 0); + rc = sub_forward (); + assert (rc == 0); + rc = timeo (); + assert (rc == 0); + + return 0; +} \ No newline at end of file diff --git a/tests/timeo.cpp b/tests/timeo.cpp index f718056..3cb09f1 100644 --- a/tests/timeo.cpp +++ b/tests/timeo.cpp @@ -20,6 +20,13 @@ #include "testutil.hpp" +#if defined XS_HAVE_WINDOWS +int XS_TEST_MAIN () +{ + return 0; +} +#else + #include extern "C" @@ -112,3 +119,4 @@ int XS_TEST_MAIN () return 0 ; } +#endif \ No newline at end of file -- cgit v1.2.3