summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-06 20:29:55 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-06 20:29:55 -0400
commit2a4a815f5801e79e67e9906eecdd544d25fcbfd6 (patch)
tree460a741ee79189dedda5bb636e8b18457e9a1f39
parent7ba47ca1fd7135fc9860caa70fc9ef7645f75950 (diff)
downloadtor-2a4a815f5801e79e67e9906eecdd544d25fcbfd6.tar.gz
tor-2a4a815f5801e79e67e9906eecdd544d25fcbfd6.zip
Fix a unit test bug for passing arguments to tor_parse_ulong.
We wanted to make sure -50 was a bad input, but instead we were passing a 'min' that was greater than 'max'.
-rw-r--r--src/test/test_util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 6836c01d31..974caeef05 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -2001,9 +2001,11 @@ test_util_parse_integer(void *arg)
tt_int_op(10UL,OP_EQ, tor_parse_ulong("10",10,10,100,NULL,NULL));
tt_int_op(0UL,OP_EQ, tor_parse_ulong("8",8,0,100,NULL,NULL));
tt_int_op(50UL,OP_EQ, tor_parse_ulong("50",10,50,100,NULL,NULL));
- tt_int_op(0UL,OP_EQ, tor_parse_ulong("-50",10,-100,100,NULL,NULL));
+ tt_int_op(0UL,OP_EQ, tor_parse_ulong("-50",10,0,100,NULL,NULL));
tt_int_op(0UL,OP_EQ, tor_parse_ulong("50",-1,50,100,&i,NULL));
tt_int_op(0,OP_EQ, i);
+ tt_int_op(0UL,OP_EQ, tor_parse_ulong("-50",10,0,100,&i,NULL));
+ tt_int_op(0,OP_EQ, i);
/* Test parse_uint64 */
tt_assert(U64_LITERAL(10) == tor_parse_uint64("10 x",10,0,100, &i, &cp));