test/logging_tests.c

changeset 95
ecfdc1c4a552
parent 81
86a23238d8a1
child 103
08018864fb91
equal deleted inserted replaced
94:57ea041df22f 95:ecfdc1c4a552
14 UCX_TEST_BEGIN 14 UCX_TEST_BEGIN
15 ucx_logger_info(logger, "allright"); 15 ucx_logger_info(logger, "allright");
16 ucx_logger_trace(logger, "dont log this!"); 16 ucx_logger_trace(logger, "dont log this!");
17 ucx_logger_error(logger, "error %d!", 42); 17 ucx_logger_error(logger, "error %d!", 42);
18 fseek(stream, 0, SEEK_SET); 18 fseek(stream, 0, SEEK_SET);
19 int r = fread(buffer, 1, 100, stream); 19 size_t r = fread(buffer, 1, 100, stream);
20 20
21 size_t expected_length = 76; 21 size_t expected_length = 76;
22 UCX_TEST_ASSERT(r == expected_length && strncmp(buffer, 22 UCX_TEST_ASSERT(r == expected_length && strncmp(buffer,
23 "[INFO] logging_tests.c:15 - allright\n" 23 "[INFO] logging_tests.c:15 - allright\n"
24 "[ERROR] logging_tests.c:17 - error 42!\n", expected_length) == 0, "incorrect logs"); 24 "[ERROR] logging_tests.c:17 - error 42!\n", expected_length) == 0, "incorrect logs");

mercurial