diff options
author | David Robillard <d@drobilla.net> | 2022-08-18 13:18:52 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-18 14:33:37 -0400 |
commit | f65912600fc301cbdbb613f1df0dc29820f1da35 (patch) | |
tree | 43db69627433fbb8f5acd13c6cf0ef8a3c3b829d /test/test_strerror.c | |
parent | c4b8ca3dc222b06c40ebcb416d653e17e88de858 (diff) | |
download | zix-f65912600fc301cbdbb613f1df0dc29820f1da35.tar.gz zix-f65912600fc301cbdbb613f1df0dc29820f1da35.tar.bz2 zix-f65912600fc301cbdbb613f1df0dc29820f1da35.zip |
Use conventional test executable names
Diffstat (limited to 'test/test_strerror.c')
-rw-r--r-- | test/test_strerror.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_strerror.c b/test/test_strerror.c new file mode 100644 index 0000000..2f4c090 --- /dev/null +++ b/test/test_strerror.c @@ -0,0 +1,31 @@ +// Copyright 2021 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#undef NDEBUG + +#include "zix/common.h" + +#include <assert.h> +#include <stdio.h> +#include <string.h> + +int +main(void) +{ + const char* msg = zix_strerror(ZIX_STATUS_SUCCESS); + assert(!strcmp(msg, "Success")); + + for (int i = ZIX_STATUS_ERROR; i <= ZIX_STATUS_REACHED_END; ++i) { + msg = zix_strerror((ZixStatus)i); + assert(strcmp(msg, "Success")); + } + + msg = zix_strerror((ZixStatus)-1); + assert(!strcmp(msg, "Unknown error")); + + msg = zix_strerror((ZixStatus)1000000); + assert(!strcmp(msg, "Unknown error")); + + printf("Success\n"); + return 0; +} |