mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Add unit test for #13290
This commit is contained in:
parent
16cf1679e7
commit
b3bc871214
@ -1074,7 +1074,7 @@ circuit_build_times_update_alpha(circuit_build_times_t *cbt)
|
||||
* random_sample_from_Pareto_distribution
|
||||
* That's right. I'll cite wikipedia all day long.
|
||||
*
|
||||
* Return value is in milliseconds.
|
||||
* Return value is in milliseconds, clamped to INT32_MAX.
|
||||
*/
|
||||
STATIC double
|
||||
circuit_build_times_calculate_timeout(circuit_build_times_t *cbt,
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user