Wed, 10 Oct 2012 14:26:53 +0200
added _Bool macro for cplusplus
54 | 1 | /* |
2 | * | |
3 | */ | |
4 | ||
5 | #include "logging_tests.h" | |
6 | ||
7 | UCX_TEST_IMPLEMENT(test_ucx_logger_log) { | |
8 | char buffer[100]; | |
55
180bc6b18fec
fixed map tests + used tmpfiles in tests
Mike Becker <universe@uap-core.de>
parents:
54
diff
changeset
|
9 | FILE *stream = tmpfile(); |
180bc6b18fec
fixed map tests + used tmpfiles in tests
Mike Becker <universe@uap-core.de>
parents:
54
diff
changeset
|
10 | |
54 | 11 | UcxLogger *logger = ucx_logger_new(stream, UCX_LOGGER_INFO); |
12 | ||
13 | UCX_TEST_BEGIN | |
14 | ucx_logger_info(logger, ST("[INFO:] allright\n")); | |
15 | ucx_logger_trace(logger, ST("[TRACE:] dont log this!\n")); | |
16 | ucx_logger_error(logger, ST("[ERROR:] error!\n")); | |
17 | fseek(stream, 0, SEEK_SET); | |
18 | fread(buffer, 1, 100, stream); | |
19 | ||
20 | UCX_TEST_ASSERT(strncmp(buffer, | |
21 | "[INFO:] allright\n[ERROR:] error!\n", 33) == 0, "incorrect logs"); | |
22 | ||
23 | UCX_TEST_END | |
24 | ||
25 | free(logger); | |
26 | fclose(stream); | |
27 | } |