1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // XFAIL: libcpp-no-exceptions 11 // test bitset<N>& reset(size_t pos); 12 13 #include <bitset> 14 #include <cassert> 15 16 #if defined(__clang__) 17 #pragma clang diagnostic push 18 #pragma clang diagnostic ignored "-Wtautological-compare" 19 #endif 20 21 template <std::size_t N> 22 void test_reset_one() 23 { 24 std::bitset<N> v; 25 try 26 { 27 v.set(); 28 v.reset(50); 29 if (50 >= v.size()) 30 assert(false); 31 for (unsigned i = 0; i < v.size(); ++i) 32 if (i == 50) 33 assert(!v[i]); 34 else 35 assert(v[i]); 36 } 37 catch (std::out_of_range&) 38 { 39 } 40 } 41 42 int main() 43 { 44 test_reset_one<0>(); 45 test_reset_one<1>(); 46 test_reset_one<31>(); 47 test_reset_one<32>(); 48 test_reset_one<33>(); 49 test_reset_one<63>(); 50 test_reset_one<64>(); 51 test_reset_one<65>(); 52 test_reset_one<1000>(); 53 } 54