diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-11-21 22:11:21 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-11-23 22:20:12 -0800 |
| commit | d1218d7309475193b53911667911c4f59a1a7752 (patch) | |
| tree | 6ea796998fb60d2cb8afa704faa77fe7fddd644c /src/core/errors_test.c | |
| parent | b826bfc171d90f8bde7bd672c0ac14201b8b2742 (diff) | |
| download | nng-d1218d7309475193b53911667911c4f59a1a7752.tar.gz nng-d1218d7309475193b53911667911c4f59a1a7752.tar.bz2 nng-d1218d7309475193b53911667911c4f59a1a7752.zip | |
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.
Diffstat (limited to 'src/core/errors_test.c')
| -rw-r--r-- | src/core/errors_test.c | 18 |
1 files changed, 7 insertions, 11 deletions
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 <errno.h> #include <string.h> -#include <nng/nng.h> - -#include <acutest.h> -#include <testutil.h> +#include <nuts.h> 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 }, |
