From d1218d7309475193b53911667911c4f59a1a7752 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 21 Nov 2020 22:11:21 -0800 Subject: New NUTS test framework (NNG Unit Test Support). This is based on testutil/acutest, but is cleaner and fixes some short-comings. We will be adding more support for additional common paradigms to better facilitate transport tests. While here we added some more test cases, and fixed a possible symbol collision in the the stats framework (due to Linux use of a macro definition of "si_value" in a standard OS header). Test coverage may regress slightly as we are no longer using some of the legacy APIs. --- src/core/errors_test.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/core/errors_test.c') diff --git a/src/core/errors_test.c b/src/core/errors_test.c index 4e50467c..52d820fe 100644 --- a/src/core/errors_test.c +++ b/src/core/errors_test.c @@ -10,35 +10,31 @@ #include #include -#include - -#include -#include +#include static void test_known_errors(void) { - - TEST_STREQUAL(nng_strerror(NNG_ECLOSED), "Object closed"); - TEST_STREQUAL(nng_strerror(NNG_ETIMEDOUT), "Timed out"); + NUTS_MATCH(nng_strerror(NNG_ECLOSED), "Object closed"); + NUTS_MATCH(nng_strerror(NNG_ETIMEDOUT), "Timed out"); } static void test_unknown_errors(void) { for (unsigned i = 1; i < 0x1000000; i = i * 2 + 100) { - TEST_CHECK(nng_strerror(i) != NULL); + NUTS_TRUE(nng_strerror(i) != NULL); } } static void test_system_errors(void) { - TEST_STREQUAL(nng_strerror(NNG_ESYSERR + ENOENT), strerror(ENOENT)); - TEST_STREQUAL(nng_strerror(NNG_ESYSERR + EINVAL), strerror(EINVAL)); + NUTS_MATCH(nng_strerror(NNG_ESYSERR + ENOENT), strerror(ENOENT)); + NUTS_MATCH(nng_strerror(NNG_ESYSERR + EINVAL), strerror(EINVAL)); } -TEST_LIST = { +NUTS_TESTS = { { "known errors", test_known_errors }, { "unknown errors", test_unknown_errors }, { "system errors", test_system_errors }, -- cgit v1.2.3-70-g09d2