| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. |
| 3 | |
| 4 | #include <cstdint> |
| 5 | #include "gtest/gtest.h" |
| 6 | |
| 7 | #include "core/auto_ptr.h" |
| 8 | |
| 9 | using namespace FASTER::core; |
| 10 | |
| 11 | TEST(UtilityTest, NextPowerOfTwo) { |
| 12 | EXPECT_EQ(1, next_power_of_two(1)); |
| 13 | EXPECT_EQ(2, next_power_of_two(2)); |
| 14 | EXPECT_EQ(4, next_power_of_two(3)); |
| 15 | EXPECT_EQ(4, next_power_of_two(4)); |
| 16 | EXPECT_EQ(8, next_power_of_two(5)); |
| 17 | EXPECT_EQ(8, next_power_of_two(6)); |
| 18 | EXPECT_EQ(8, next_power_of_two(7)); |
| 19 | EXPECT_EQ(8, next_power_of_two(8)); |
| 20 | } |
| 21 | |
| 22 | int main(int argc, char** argv) { |
| 23 | ::testing::InitGoogleTest(&argc, argv); |
| 24 | return RUN_ALL_TESTS(); |
| 25 | } |