aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.h
diff options
context:
space:
mode:
authordana koch <dsk@google.com>2014-04-15 22:20:34 +1000
committerNick Mathewson <nickm@torproject.org>2014-04-15 15:00:34 -0400
commit3ce3984772b673b82a87aded1bc8a1a0f1969e19 (patch)
treeae9e005f34ae81ff04c006ef179575de5b277bb8 /src/or/main.h
parent2704441e7ff1242d168bc14dda946fc41844f2c5 (diff)
downloadtor-3ce3984772b673b82a87aded1bc8a1a0f1969e19.tar
tor-3ce3984772b673b82a87aded1bc8a1a0f1969e19.tar.gz
Uplift status.c unit test coverage with new test cases and macros.
A new set of unit test cases are provided, as well as introducing an alternative paradigm and macros to support it. Primarily, each test case is given its own namespace, in order to isolate tests from each other. We do this by in the usual fashion, by appending module and submodule names to our symbols. New macros assist by reducing friction for this and other tasks, like overriding a function in the global namespace with one in the current namespace, or declaring integer variables to assist tracking how many times a mock has been called. A set of tests for a small-scale module has been included in this commit, in order to highlight how the paradigm can be used. This suite gives 100% coverage to status.c in test execution.
Diffstat (limited to 'src/or/main.h')
-rw-r--r--src/or/main.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/main.h b/src/or/main.h
index a2f03d954..a3bce3486 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -24,8 +24,8 @@ void add_connection_to_closeable_list(connection_t *conn);
int connection_is_on_closeable_list(connection_t *conn);
smartlist_t *get_connection_array(void);
-uint64_t get_bytes_read(void);
-uint64_t get_bytes_written(void);
+MOCK_DECL(uint64_t,get_bytes_read,(void));
+MOCK_DECL(uint64_t,get_bytes_written,(void));
/** Bitmask for events that we can turn on and off with
* connection_watch_events. */
@@ -52,7 +52,8 @@ void ip_address_changed(int at_interface);
void dns_servers_relaunch_checks(void);
void reschedule_descriptor_update_check(void);
-long get_uptime(void);
+MOCK_DECL(long,get_uptime,(void));
+
unsigned get_signewnym_epoch(void);
void handle_signals(int is_parent);