aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-05-29 12:21:41 -0700
committerGarrett D'Amore <garrett@damore.org>2018-05-29 16:05:05 -0700
commitfe5336ec1f9f27045f2c27ac253285c8447aa653 (patch)
treee3746ee0ea69a64a91ea45ddc0f38dfb2bbd4289 /tests
parenta25ff30c96e41273cb8ac292667195f1861d4f50 (diff)
downloadnng-fe5336ec1f9f27045f2c27ac253285c8447aa653.tar.gz
nng-fe5336ec1f9f27045f2c27ac253285c8447aa653.tar.bz2
nng-fe5336ec1f9f27045f2c27ac253285c8447aa653.zip
fixes #419 Remove the "convey" meta test
The test itself is not sanitizer friendly, and we don't need to do this meta testing; convey already does it in it's own repo.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt7
-rw-r--r--tests/convey_test.c147
2 files changed, 0 insertions, 154 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 31b5fe29..9ba25882 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -38,13 +38,6 @@ include_directories(AFTER SYSTEM ${PROJECT_SOURCE_DIR}/src)
if (NNG_TESTS)
- # convey tests -- verify the test framework works!
- add_executable(convey_test convey_test.c convey.c)
- target_link_libraries (convey_test Threads::Threads)
- add_test (NAME convey_test COMMAND convey_test
- -v -d -p ENV_TEST=ON -p ANOTHERNAME -p AGAIN=yes extra)
- set_tests_properties (convey_test PROPERTIES TIMEOUT 2)
-
set (NNG_TEST_PORT 13000)
macro (add_nng_test NAME TIMEOUT)
add_executable (${NAME} ${NAME}.c convey.c)
diff --git a/tests/convey_test.c b/tests/convey_test.c
deleted file mode 100644
index 53ea2954..00000000
--- a/tests/convey_test.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2018 Garrett D'Amore <garrett@damore.org>
- *
- * 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.
- */
-
-/*
- * This file is intended to test the framework. It also demonstrates
- * some of the capabilities.
- */
-
-#include "convey.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-Main({
-
- /*
- * The ordering test demonstrates the execution order.
- * At the end of each inner Convey, we roll back up the stack
- * to the root, and then start over, bypassing Convey blocks
- * that have already completed. Note that if a Convey block
- * is the last thing in an enclosing Convey, we will make
- * one more pass all the way through until we bypass that last
- * item and can close the outer Convey.
- */
- Test("Ordering", {
- /*
- * The buffer has to be static because don't want to clear
- * it with each new pass -- that would defeat our tests!
- * Note that it starts zeroed (C standard).
- */
- static char buffer[32];
- static int bufidx;
-
- Convey("A runs first", { buffer[bufidx++] = 'A'; });
- Printf("Bufidx is now %d", 1);
- buffer[bufidx++] = '1';
-
- Convey("B runs after A", {
-
- So(strlen(buffer) > 0);
- So(buffer[bufidx - 1] == '1');
- buffer[bufidx++] = 'B';
-
- Convey("C runs inside B", {
- So(buffer[bufidx - 1] == 'B');
- buffer[bufidx++] = 'C';
- });
- });
-
- Convey("D runs afer A, B, C.", {
- So(buffer[bufidx - 1] == '1');
- buffer[bufidx++] = 'D';
- });
-
- buffer[bufidx++] = '2';
-
- Convey("E is last", {
- So(buffer[bufidx - 1] == '2');
- buffer[bufidx++] = 'E';
- });
-
- So(strcmp(buffer, "A1BC1B1D12E12") == 0);
- });
-
- Test("Skipping works", {
- int skipped = 0;
- SkipConvey("ConveySkip works.", { So(skipped = 0); });
- So(skipped == 0);
- Convey("Assertion skipping works.", { SkipSo(skipped == 1); });
- So(skipped == 0);
- });
-
- Test("Reset", {
- static int x;
-
- Convey("Initialize X to a non-zero value", {
- So(x == 0);
- x = 1;
- So(x == 1);
- });
-
- Reset({ x = 20; });
-
- Convey("Verify that reset did not get called", {
- So(x == 1);
- x = 5;
- So(x == 5);
- });
-
- Convey("But now it did", { So(x == 20); });
- });
-
- /* save the current status so we can override */
- int oldrv = convey_main_rv;
- Test("Failures work", {
- Convey("Assertion failure works",
- { Convey("Injected failure", { So(1 == 0); }); });
-
- Convey("ConveyFail works", { ConveyFail("forced failure"); });
-
- Convey("ConveyError works", { ConveyError("forced error"); });
- });
-
- /* Override the result variable to reset failure. */
- convey_main_rv = oldrv;
-
- Test("Environment works", {
- Convey("PATH environment", {
- So(ConveyGetEnv("PATH") != NULL);
- So(strlen(ConveyGetEnv("PATH")) != 0);
- });
- Convey("Command line args work", {
- char *v1 = ConveyGetEnv("ANOTHERNAME");
- char *v2 = ConveyGetEnv("AGAIN");
- if (ConveyGetEnv("NAMETEST") == NULL) {
- SkipSo(v1 != NULL);
- SkipSo(v2 != NULL);
- SkipSo(strcmp(v1, "") == 0);
- SkipSo(strcmp(v2, "YES") == 0);
- } else {
- So(v1 != NULL);
- So(v2 != NULL);
- So(strcmp(v1, "") == 0);
- So(strcmp(v2, "YES") == 0);
- }
- })
- });
-})