diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-09-08 14:39:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-09-08 14:39:20 -0400 |
commit | b0a9e54705d16d08ae7aff272492832dbb35646d (patch) | |
tree | 82064efbdc8c3ed2151c9783cbf6aab44e565df1 /src/test/log_test_helpers.h | |
parent | d0fe86f39ebcc9b2e17ee3b7fb638e34c2133418 (diff) | |
download | tor-b0a9e54705d16d08ae7aff272492832dbb35646d.tar.gz tor-b0a9e54705d16d08ae7aff272492832dbb35646d.zip |
Resolve more BUG warnings in the unit tests
Diffstat (limited to 'src/test/log_test_helpers.h')
-rw-r--r-- | src/test/log_test_helpers.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/test/log_test_helpers.h b/src/test/log_test_helpers.h index bf2f9a6beb..fd990845d9 100644 --- a/src/test/log_test_helpers.h +++ b/src/test/log_test_helpers.h @@ -26,6 +26,7 @@ int mock_saved_log_has_message(const char *msg); int mock_saved_log_has_message_containing(const char *msg); int mock_saved_log_has_severity(int severity); int mock_saved_log_has_entry(void); +int mock_saved_log_n_entries(void); void mock_dump_saved_logs(void); #define assert_log_predicate(predicate, failure_msg) \ @@ -50,11 +51,19 @@ void mock_dump_saved_logs(void); mock_saved_log_has_message_containing(str2), \ "expected log to contain " # str1 " or " # str2); +#define expect_single_log_msg(str) \ + do { \ + \ + assert_log_predicate(mock_saved_log_has_message_containing(str) && \ + mock_saved_log_n_entries() == 1, \ + "expected log to contain exactly 1 message: " # str); \ + } while (0); + #define expect_single_log_msg_containing(str) \ - do { \ - assert_log_predicate(mock_saved_log_has_message_containing(str), \ - "expected log to contain " # str); \ - tt_int_op(smartlist_len(mock_saved_logs()), OP_EQ, 1); \ + do { \ + assert_log_predicate(mock_saved_log_has_message_containing(str)&& \ + mock_saved_log_n_entries() == 1 , \ + "expected log to contain 1 message, containing" # str); \ } while (0); #define expect_no_log_msg(str) \ |