aboutsummaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-15 22:07:49 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-15 22:07:49 -0800
commit2fea9b850333d8f48e83fbbd87921f47c1fa8bb5 (patch)
treed92973acba58636f06d644de14ee06954f1768c2 /tests/CMakeLists.txt
parent474168faf403fc9e9733c7bcb826773dc00eced1 (diff)
downloadnng-2fea9b850333d8f48e83fbbd87921f47c1fa8bb5.tar.gz
nng-2fea9b850333d8f48e83fbbd87921f47c1fa8bb5.tar.bz2
nng-2fea9b850333d8f48e83fbbd87921f47c1fa8bb5.zip
Early test framework, modeled on GoConvey.
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 00000000..1d8bcad5
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 2012 Martin Sustrik All rights reserved.
+# Copyright (c) 2013 GoPivotal, Inc. All rights reserved.
+# Copyright (c) 2015-2016 Jack R. Dunaway. All rights reserved.
+# Copyright 2016 Garrett D'Amore <garrett@damore.org>
+# Copyright 2016 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+
+# Build unit tests.
+
+if (NNG_TESTS)
+
+ enable_testing ()
+ set (all_tests "")
+
+ set (TEST_PORT 12100)
+ macro (add_nng_test NAME TIMEOUT)
+ list (APPEND all_tests ${NAME})
+ add_executable (${NAME} ${NAME}.c test.c)
+ target_link_libraries (${NAME} ${PROJECT_NAME})
+ add_test (NAME ${NAME} COMMAND ${NAME} ${TEST_PORT})
+ set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT})
+ math (EXPR TEST_PORT "${TEST_PORT}+10")
+ endmacro (add_nng_test)
+
+ macro (add_nng_perf NAME)
+ add_executable (${NAME} perf/${NAME}.c)
+ target_link_libraries (${NAME} ${PROJECT_NAME})
+ endmacro (add_nng_perf)
+
+else ()
+ macro (add_nng_test NAME TIMEOUT)
+ endmacro (add_nng_test)
+ macro (add_nng_perf NAME)
+ endmacro (add_nng_perf)
+endif ()
+
+add_nng_test(demo 5)