aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_dir.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-26 09:22:04 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-16 11:06:16 -0500
commit039bd01767d42961cb16ff4914481332b52cf8db (patch)
tree52048c96bd405e8dbe544ae97889185cd048a3bb /src/test/test_dir.c
parent2ea5aa71823f385e36f20e643a20996dcb164464 (diff)
downloadtor-039bd01767d42961cb16ff4914481332b52cf8db.tar.gz
tor-039bd01767d42961cb16ff4914481332b52cf8db.zip
Add a wrapper for a common networkstatus param pattern
We frequently want to check a networkstatus parameter only when it isn't overridden from the torrc file.
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r--src/test/test_dir.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 4501d6b547..4ef421f8e3 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -1494,6 +1494,15 @@ test_dir_param_voting(void *arg)
tt_int_op(-8,OP_EQ, networkstatus_get_param(&vote4, "ab", -12, -100, -8));
tt_int_op(0,OP_EQ, networkstatus_get_param(&vote4, "foobar", 0, -100, 8));
+ tt_int_op(100,OP_EQ, networkstatus_get_overridable_param(
+ &vote4, -1, "x-yz", 50, 0, 300));
+ tt_int_op(30,OP_EQ, networkstatus_get_overridable_param(
+ &vote4, 30, "x-yz", 50, 0, 300));
+ tt_int_op(0,OP_EQ, networkstatus_get_overridable_param(
+ &vote4, -101, "foobar", 0, -100, 8));
+ tt_int_op(-99,OP_EQ, networkstatus_get_overridable_param(
+ &vote4, -99, "foobar", 0, -100, 8));
+
smartlist_add(votes, &vote1);
/* Do the first tests without adding all the other votes, for