summaryrefslogtreecommitdiff
path: root/src/test/test.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2015-02-06 20:39:10 +0100
committerSebastian Hahn <sebastian@torproject.org>2015-02-06 21:04:05 +0100
commitb3bc8712140b8268cb3714b17b9678eefe66e90e (patch)
tree73b3cfcf005689a89a1738a609841547d7057f17 /src/test/test.c
parent16cf1679e78c690869be3d26448a965e8d1330b0 (diff)
downloadtor-b3bc8712140b8268cb3714b17b9678eefe66e90e.tar.gz
tor-b3bc8712140b8268cb3714b17b9678eefe66e90e.zip
Add unit test for #13290
Diffstat (limited to 'src/test/test.c')
-rw-r--r--src/test/test.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 85a7ad6c7c..7995af3c69 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -442,6 +442,14 @@ test_circuit_timeout(void *arg)
tt_assert(circuit_build_times_network_check_live(&final));
circuit_build_times_count_timeout(&final, 1);
+
+ /* Ensure return value for degenerate cases are clamped correctly */
+ initial.alpha = INT32_MAX;
+ tt_assert(circuit_build_times_calculate_timeout(&initial, .99999999) <=
+ INT32_MAX);
+ initial.alpha = 0;
+ tt_assert(circuit_build_times_calculate_timeout(&initial, .5) <=
+ INT32_MAX);
}
done: