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