summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/log_test_helpers.c5
-rw-r--r--src/test/log_test_helpers.h1
-rw-r--r--src/test/test.c1
-rw-r--r--src/test/test_compat_libevent.c68
4 files changed, 52 insertions, 23 deletions
diff --git a/src/test/log_test_helpers.c b/src/test/log_test_helpers.c
index 925f0f1de4..51b5f9b7b1 100644
--- a/src/test/log_test_helpers.c
+++ b/src/test/log_test_helpers.c
@@ -1,3 +1,5 @@
+/* Copyright (c) 2015, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
#define LOG_PRIVATE
#include "torlog.h"
#include "log_test_helpers.h"
@@ -37,7 +39,7 @@ static mock_saved_log_entry_t *
mock_get_log_entry(int ix)
{
int saved_log_count = mock_saved_log_number();
- if(ix < 0) {
+ if (ix < 0) {
ix = saved_log_count + ix;
}
@@ -106,3 +108,4 @@ mock_saving_logv(int severity, log_domain_mask_t domain,
saved_logs = smartlist_new();
smartlist_add(saved_logs, e);
}
+
diff --git a/src/test/log_test_helpers.h b/src/test/log_test_helpers.h
index 4822ce5677..af8e8a60e7 100644
--- a/src/test/log_test_helpers.h
+++ b/src/test/log_test_helpers.h
@@ -28,3 +28,4 @@ int mock_saved_severity_at(int ix);
int mock_saved_log_number(void);
#endif
+
diff --git a/src/test/test.c b/src/test/test.c
index 8427471bea..4cb33c9a18 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1212,3 +1212,4 @@ struct testgroup_t testgroups[] = {
{ "dns/", dns_tests },
END_OF_GROUPS
};
+
diff --git a/src/test/test_compat_libevent.c b/src/test/test_compat_libevent.c
index 7e5b7df299..96502df308 100644
--- a/src/test/test_compat_libevent.c
+++ b/src/test/test_compat_libevent.c
@@ -31,47 +31,67 @@ test_compat_libevent_logging_callback(void *ignored)
libevent_logging_callback(_EVENT_LOG_DEBUG, "hello world");
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Message from libevent: hello world\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ,
+ "Message from libevent: hello world\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_DEBUG);
mock_clean_saved_logs();
libevent_logging_callback(_EVENT_LOG_MSG, "hello world another time");
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Message from libevent: hello world another time\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ,
+ "Message from libevent: hello world another time\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_INFO);
mock_clean_saved_logs();
libevent_logging_callback(_EVENT_LOG_WARN, "hello world a third time");
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Warning from libevent: hello world a third time\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ,
+ "Warning from libevent: hello world a third time\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_WARN);
mock_clean_saved_logs();
libevent_logging_callback(_EVENT_LOG_ERR, "hello world a fourth time");
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Error from libevent: hello world a fourth time\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ,
+ "Error from libevent: hello world a fourth time\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_ERR);
mock_clean_saved_logs();
libevent_logging_callback(42, "hello world a fifth time");
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Message [42] from libevent: hello world a fifth time\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ,
+ "Message [42] from libevent: hello world a fifth time\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_WARN);
mock_clean_saved_logs();
- libevent_logging_callback(_EVENT_LOG_DEBUG, "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
- "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789");
+ libevent_logging_callback(_EVENT_LOG_DEBUG,
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ );
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Message from libevent: 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ, "Message from libevent: "
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789"
+ "012345678901234567890123456789\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_DEBUG);
mock_clean_saved_logs();
@@ -84,7 +104,8 @@ test_compat_libevent_logging_callback(void *ignored)
mock_clean_saved_logs();
libevent_logging_callback(_EVENT_LOG_MSG, "hello there");
tt_int_op(mock_saved_log_number(), OP_EQ, 1);
- tt_str_op(mock_saved_log_at(0), OP_EQ, "Message from libevent: hello there\n");
+ tt_str_op(mock_saved_log_at(0), OP_EQ,
+ "Message from libevent: hello there\n");
tt_int_op(mock_saved_severity_at(0), OP_EQ, LOG_INFO);
mock_clean_saved_logs();
@@ -204,11 +225,14 @@ test_compat_libevent_header_version(void *ignored)
(void)0;
}
-
struct testcase_t compat_libevent_tests[] = {
- { "logging_callback", test_compat_libevent_logging_callback, TT_FORK, NULL, NULL },
- { "le_versions_compatibility", test_compat_libevent_le_versions_compatibility, 0, NULL, NULL },
- { "tor_decode_libevent_version", test_compat_libevent_tor_decode_libevent_version, 0, NULL, NULL },
+ { "logging_callback", test_compat_libevent_logging_callback,
+ TT_FORK, NULL, NULL },
+ { "le_versions_compatibility",
+ test_compat_libevent_le_versions_compatibility, 0, NULL, NULL },
+ { "tor_decode_libevent_version",
+ test_compat_libevent_tor_decode_libevent_version, 0, NULL, NULL },
{ "header_version", test_compat_libevent_header_version, 0, NULL, NULL },
END_OF_TESTCASES
};
+