summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-12 11:32:14 -0500
committerNick Mathewson <nickm@torproject.org>2015-11-12 11:32:14 -0500
commit0694263b7533ba000d3d95a2936115b21b806a5d (patch)
treee9282168460bc9bfd086a2feab585493fff38c8d /src/test/test_util.c
parent75fc4d551174b712a0468ae7a8be821b566ef1f9 (diff)
downloadtor-0694263b7533ba000d3d95a2936115b21b806a5d.tar.gz
tor-0694263b7533ba000d3d95a2936115b21b806a5d.zip
Make round_to_next_multiple_of always round upwards.
Yes, even if it has to return a non-multiple. This prevents us from ever having a bug where we try to use it for allocation, and under-allocate.
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index d23ce5f9a9..8ae5bb3105 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -4056,7 +4056,7 @@ test_util_round_to_next_multiple_of(void *arg)
tt_u64_op(round_uint64_to_next_multiple_of(99,9), ==, 99);
tt_u64_op(round_uint64_to_next_multiple_of(UINT64_MAX,2), ==,
- UINT64_MAX-UINT64_MAX%2);
+ UINT64_MAX);
tt_i64_op(round_int64_to_next_multiple_of(0,1), ==, 0);
tt_i64_op(round_int64_to_next_multiple_of(0,7), ==, 0);
@@ -4071,7 +4071,7 @@ test_util_round_to_next_multiple_of(void *arg)
tt_i64_op(round_int64_to_next_multiple_of(INT64_MIN,2), ==, INT64_MIN);
tt_i64_op(round_int64_to_next_multiple_of(INT64_MAX,2), ==,
- INT64_MAX-INT64_MAX%2);
+ INT64_MAX);
tt_int_op(round_uint32_to_next_multiple_of(0,1), ==, 0);
tt_int_op(round_uint32_to_next_multiple_of(0,7), ==, 0);
@@ -4081,7 +4081,7 @@ test_util_round_to_next_multiple_of(void *arg)
tt_int_op(round_uint32_to_next_multiple_of(99,9), ==, 99);
tt_int_op(round_uint32_to_next_multiple_of(UINT32_MAX,2), ==,
- UINT32_MAX-UINT32_MAX%2);
+ UINT32_MAX);
tt_uint_op(round_to_next_multiple_of(0,1), ==, 0);
tt_uint_op(round_to_next_multiple_of(0,7), ==, 0);
@@ -4091,7 +4091,7 @@ test_util_round_to_next_multiple_of(void *arg)
tt_uint_op(round_to_next_multiple_of(99,9), ==, 99);
tt_uint_op(round_to_next_multiple_of(UINT_MAX,2), ==,
- UINT_MAX-UINT_MAX%2);
+ UINT_MAX);
done:
;
}