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

Commit

Permalink
tests: more power of two tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Hergert committed Jun 5, 2014
1 parent 9904492 commit 1f6194f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test-bson.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,14 @@ test_next_power_of_two (void)
s = bson_next_power_of_two (s);
assert (s == 128);

s = 939524096UL;
s = bson_next_power_of_two (s);
assert (s == 1073741824);

s = 1073741824UL;
s = bson_next_power_of_two (s);
assert (s == 1073741824UL);

#if BSON_WORD_SIZE == 64
s = 4294967296LL;
s = bson_next_power_of_two (s);
Expand All @@ -1389,6 +1397,14 @@ test_next_power_of_two (void)
s = 17179901952LL;
s = bson_next_power_of_two (s);
assert (s == 34359738368LL);

s = 9223372036854775807ULL;
s = bson_next_power_of_two (s);
assert (s == 9223372036854775808ULL);

s = 36028795806651656ULL;
s = bson_next_power_of_two (s);
assert (s == 36028797018963968ULL);
#endif
}

Expand Down

0 comments on commit 1f6194f

Please sign in to comment.