Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.

Commit 1f6194f

Browse files
author
Christian Hergert
committed
tests: more power of two tests.
1 parent 9904492 commit 1f6194f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test-bson.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,14 @@ test_next_power_of_two (void)
13771377
s = bson_next_power_of_two (s);
13781378
assert (s == 128);
13791379

1380+
s = 939524096UL;
1381+
s = bson_next_power_of_two (s);
1382+
assert (s == 1073741824);
1383+
1384+
s = 1073741824UL;
1385+
s = bson_next_power_of_two (s);
1386+
assert (s == 1073741824UL);
1387+
13801388
#if BSON_WORD_SIZE == 64
13811389
s = 4294967296LL;
13821390
s = bson_next_power_of_two (s);
@@ -1389,6 +1397,14 @@ test_next_power_of_two (void)
13891397
s = 17179901952LL;
13901398
s = bson_next_power_of_two (s);
13911399
assert (s == 34359738368LL);
1400+
1401+
s = 9223372036854775807ULL;
1402+
s = bson_next_power_of_two (s);
1403+
assert (s == 9223372036854775808ULL);
1404+
1405+
s = 36028795806651656ULL;
1406+
s = bson_next_power_of_two (s);
1407+
assert (s == 36028797018963968ULL);
13921408
#endif
13931409
}
13941410

0 commit comments

Comments
 (0)