Index: libcxx/trunk/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp =================================================================== --- libcxx/trunk/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp +++ libcxx/trunk/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp @@ -7,13 +7,14 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test bitset& flip(size_t pos); #include #include #include +#include "test_macros.h" + template std::bitset make_bitset() @@ -25,11 +26,15 @@ } template -void test_flip_one() +void test_flip_one(bool test_throws) { std::bitset v = make_bitset(); +#ifdef TEST_HAS_NO_EXCEPTIONS + if (test_throws) return; +#else try { +#endif v.flip(50); bool b = v[50]; if (50 >= v.size()) @@ -39,21 +44,25 @@ assert(v[50] != b); v.flip(50); assert(v[50] == b); + assert(!test_throws); +#ifndef TEST_HAS_NO_EXCEPTIONS } catch (std::out_of_range&) { + assert(test_throws); } +#endif } int main() { - test_flip_one<0>(); - test_flip_one<1>(); - test_flip_one<31>(); - test_flip_one<32>(); - test_flip_one<33>(); - test_flip_one<63>(); - test_flip_one<64>(); - test_flip_one<65>(); - test_flip_one<1000>(); + test_flip_one<0>(true); + test_flip_one<1>(true); + test_flip_one<31>(true); + test_flip_one<32>(true); + test_flip_one<33>(true); + test_flip_one<63>(false); + test_flip_one<64>(false); + test_flip_one<65>(false); + test_flip_one<1000>(false); } Index: libcxx/trunk/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp =================================================================== --- libcxx/trunk/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp +++ libcxx/trunk/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp @@ -7,18 +7,23 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test bitset& reset(size_t pos); #include #include +#include "test_macros.h" + template -void test_reset_one() +void test_reset_one(bool test_throws) { std::bitset v; +#ifdef TEST_HAS_NO_EXCEPTIONS + if (test_throws) return; +#else try { +#endif v.set(); v.reset(50); if (50 >= v.size()) @@ -28,21 +33,25 @@ assert(!v[i]); else assert(v[i]); + assert(!test_throws); +#ifndef TEST_HAS_NO_EXCEPTIONS } catch (std::out_of_range&) { + assert(test_throws); } +#endif } int main() { - test_reset_one<0>(); - test_reset_one<1>(); - test_reset_one<31>(); - test_reset_one<32>(); - test_reset_one<33>(); - test_reset_one<63>(); - test_reset_one<64>(); - test_reset_one<65>(); - test_reset_one<1000>(); + test_reset_one<0>(true); + test_reset_one<1>(true); + test_reset_one<31>(true); + test_reset_one<32>(true); + test_reset_one<33>(true); + test_reset_one<63>(false); + test_reset_one<64>(false); + test_reset_one<65>(false); + test_reset_one<1000>(false); } Index: libcxx/trunk/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp =================================================================== --- libcxx/trunk/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp +++ libcxx/trunk/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp @@ -7,47 +7,60 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test bitset& set(size_t pos, bool val = true); #include #include +#include "test_macros.h" + template -void test_set_one() +void test_set_one(bool test_throws) { std::bitset v; +#ifdef TEST_HAS_NO_EXCEPTIONS + if (test_throws) return; +#else try +#endif { v.set(50); if (50 >= v.size()) assert(false); assert(v[50]); + assert(!test_throws); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (std::out_of_range&) { + assert(test_throws); } try +#endif { v.set(50, false); if (50 >= v.size()) assert(false); assert(!v[50]); + assert(!test_throws); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (std::out_of_range&) { + assert(test_throws); } +#endif } int main() { - test_set_one<0>(); - test_set_one<1>(); - test_set_one<31>(); - test_set_one<32>(); - test_set_one<33>(); - test_set_one<63>(); - test_set_one<64>(); - test_set_one<65>(); - test_set_one<1000>(); + test_set_one<0>(true); + test_set_one<1>(true); + test_set_one<31>(true); + test_set_one<32>(true); + test_set_one<33>(true); + test_set_one<63>(false); + test_set_one<64>(false); + test_set_one<65>(false); + test_set_one<1000>(false); } Index: libcxx/trunk/test/std/utilities/template.bitset/bitset.members/test.pass.cpp =================================================================== --- libcxx/trunk/test/std/utilities/template.bitset/bitset.members/test.pass.cpp +++ libcxx/trunk/test/std/utilities/template.bitset/bitset.members/test.pass.cpp @@ -7,13 +7,14 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test constexpr bool test(size_t pos) const; #include #include #include +#include "test_macros.h" + template std::bitset make_bitset() @@ -25,30 +26,38 @@ } template -void test_test() +void test_test(bool test_throws) { const std::bitset v1 = make_bitset(); +#ifdef TEST_HAS_NO_EXCEPTIONS + if (test_throws) return; +#else try { +#endif bool b = v1.test(50); if (50 >= v1.size()) assert(false); assert(b == v1[50]); + assert(!test_throws); +#ifndef TEST_HAS_NO_EXCEPTIONS } catch (std::out_of_range&) { + assert(test_throws); } +#endif } int main() { - test_test<0>(); - test_test<1>(); - test_test<31>(); - test_test<32>(); - test_test<33>(); - test_test<63>(); - test_test<64>(); - test_test<65>(); - test_test<1000>(); + test_test<0>(true); + test_test<1>(true); + test_test<31>(true); + test_test<32>(true); + test_test<33>(true); + test_test<63>(false); + test_test<64>(false); + test_test<65>(false); + test_test<1000>(false); }