diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2017-06-03 01:21:29 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2017-06-03 01:21:29 +0000 |
| commit | 1798ec5241dda49f295dd52e1f903327363f6562 (patch) | |
| tree | 08d012f371274cbe3c254a9ee1691dcf98262e9a /libcxx | |
| parent | e042412ef1b0a3650eeab49368eb968af452e933 (diff) | |
| download | bcm5719-llvm-1798ec5241dda49f295dd52e1f903327363f6562.tar.gz bcm5719-llvm-1798ec5241dda49f295dd52e1f903327363f6562.zip | |
Fix the recently introduced test to work on C++03
llvm-svn: 304629
Diffstat (limited to 'libcxx')
| -rw-r--r-- | libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp b/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp index 088c06a6819..3784eb87ceb 100644 --- a/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // REQUIRES: long_tests +// UNSUPPORTED: c++98, c++03 // Not a portable test @@ -30,6 +31,12 @@ is_power_of_two(unsigned long n) return __builtin_popcount(n) == 1; } +void test_next_pow2_val(size_t n) +{ + std::size_t npow2 = std::__next_hash_pow2(n); + assert(is_power_of_two(npow2) && npow2 > n); +} + void test_next_pow2() { @@ -47,11 +54,12 @@ test_next_pow2() assert(std::__next_hash_pow2(pow2) == pow2); } - for (std::size_t n : {3, 7, 9, 15, 127, 129}) - { - std::size_t npow2 = std::__next_hash_pow2(n); - assert(is_power_of_two(npow2) && npow2 > n); - } + test_next_pow2_val(3); + test_next_pow2_val(7); + test_next_pow2_val(9); + test_next_pow2_val(15); + test_next_pow2_val(127); + test_next_pow2_val(129); } // Note: this is only really useful when run with -fsanitize=undefined. |

