diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/.clang-tidy | 1 | ||||
-rw-r--r-- | test/test_reader_writer.c | 22 |
2 files changed, 22 insertions, 1 deletions
diff --git a/test/.clang-tidy b/test/.clang-tidy index 2e3f5b1d..4450bf3b 100644 --- a/test/.clang-tidy +++ b/test/.clang-tidy @@ -9,6 +9,7 @@ Checks: > -clang-analyzer-nullability.NullabilityBase, -clang-analyzer-nullability.NullableDereferenced, -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, + -concurrency-mt-unsafe, -cppcoreguidelines-avoid-non-const-global-variables, -hicpp-signed-bitwise, -readability-function-cognitive-complexity, diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index e93a7942..0da63f85 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -443,13 +443,33 @@ test_reader(const char* path) int main(void) { +#ifdef _WIN32 + char tmp[MAX_PATH] = {0}; + const size_t tmp_len = (size_t)GetTempPath(sizeof(tmp), tmp); +#else + const char* const env_tmp = getenv("TMPDIR"); + const char* const tmp = env_tmp ? env_tmp : "/tmp"; + const size_t tmp_len = strlen(tmp); +#endif + + const char* const name = "serd_test_reader_writer.ttl"; + const size_t name_len = strlen(name); + const size_t path_len = tmp_len + 1 + name_len; + char* const path = (char*)calloc(path_len + 1, 1); + + memcpy(path, tmp, tmp_len + 1); + path[tmp_len] = '/'; + memcpy(path + tmp_len + 1, name, name_len + 1); + test_read_chunks(); test_read_string(); - const char* const path = "serd_test.ttl"; test_writer(path); test_reader(path); + assert(!remove(path)); + free(path); + printf("Success\n"); return 0; } |