Bitset tests feature a sequence of tests of increasing bitset sizes,
but these tests rely on exceptions when the bitset size is less than
50 elements. So under libcpp-no-exceptions do not run the
smaller-than-50 tests.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Instead of just #ifdef-ing out the tests that throw I would rather see something like this:
template <std::size_t N> void test_test(bool test_throws) { const std::bitset<N> v1 = make_bitset<N>(); #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() { // Throwing cases test_test<33>(true); // Non-throwing cases test_test<63>(false); }