Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // test bitset<N>& set(); |
| 11 | |
| 12 | #include <bitset> |
| 13 | #include <cassert> |
| 14 | |
Howard Hinnant | 97ecd64 | 2011-05-17 19:12:55 +0000 | [diff] [blame] | 15 | #pragma clang diagnostic ignored "-Wtautological-compare" |
| 16 | |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 17 | template <std::size_t N> |
| 18 | void test_set_all() |
| 19 | { |
| 20 | std::bitset<N> v; |
| 21 | v.set(); |
| 22 | for (std::size_t i = 0; i < N; ++i) |
| 23 | assert(v[i]); |
| 24 | } |
| 25 | |
| 26 | int main() |
| 27 | { |
| 28 | test_set_all<0>(); |
| 29 | test_set_all<1>(); |
| 30 | test_set_all<31>(); |
| 31 | test_set_all<32>(); |
| 32 | test_set_all<33>(); |
| 33 | test_set_all<63>(); |
| 34 | test_set_all<64>(); |
| 35 | test_set_all<65>(); |
| 36 | test_set_all<1000>(); |
| 37 | } |