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 #pragma clang diagnostic push 17 #pragma clang diagnostic ignored "-Wtautological-compare" 18 19 template <std::size_t N> 20 void test_reset_one() 21 { 22 std::bitset<N> v; 23 try 24 { 25 v.set(); 26 v.reset(50); 27 if (50 >= v.size()) 28 assert(false); 29 for (unsigned i = 0; i < v.size(); ++i) 30 if (i == 50) 31 assert(!v[i]); 32 else 33 assert(v[i]); 34 } 35 catch (std::out_of_range&) 36 { 37 } 38 } 39 40 int main() 41 { 42 test_reset_one<0>(); 43 test_reset_one<1>(); 44 test_reset_one<31>(); 45 test_reset_one<32>(); 46 test_reset_one<33>(); 47 test_reset_one<63>(); 48 test_reset_one<64>(); 49 test_reset_one<65>(); 50 test_reset_one<1000>(); 51 } 52