diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-06-02 04:03:31 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-06-02 04:03:31 +0000 |
commit | 4efa1ad561d7f3e9b6e81f91b1ad684db55db157 (patch) | |
tree | 4a71d721fffa7ca6ae6656a47c84fc10a5189acd /libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp | |
parent | 3e7bf586f8a73dccf913d0f145bc576afb3ae52c (diff) | |
download | bcm5719-llvm-4efa1ad561d7f3e9b6e81f91b1ad684db55db157.tar.gz bcm5719-llvm-4efa1ad561d7f3e9b6e81f91b1ad684db55db157.zip |
Mark LWG issue 2250 as complete
llvm-svn: 271475
Diffstat (limited to 'libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp | 88 |
1 files changed, 40 insertions, 48 deletions
diff --git a/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp index a040a37b90f..0e4793027c9 100644 --- a/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test bitset(string, pos, n, zero, one); #include <bitset> @@ -15,67 +14,60 @@ #include <algorithm> // for 'min' and 'max' #include <stdexcept> // for 'invalid_argument' -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wtautological-compare" -#endif +#include "test_macros.h" template <std::size_t N> void test_string_ctor() { +#ifndef TEST_HAS_NO_EXCEPTIONS { - try - { - std::string str("xxx1010101010xxxx"); - std::bitset<N> v(str, str.size()+1, 10); - assert(false); - } - catch (std::out_of_range&) - { - } + try { + std::string str("xxx1010101010xxxx"); + std::bitset<N> v(str, str.size()+1, 10); + assert(false); + } + catch (std::out_of_range&) + { + } } - - { - try { - std::string str("xxx1010101010xxxx"); - std::bitset<N> v(str, 2, 10); - assert(false); + try { + std::string str("xxx1010101010xxxx"); + std::bitset<N> v(str, 2, 10); + assert(false); + } + catch (std::invalid_argument&) + { + } } - catch (std::invalid_argument&) { + try { + std::string str("xxxbababababaxxxx"); + std::bitset<N> v(str, 2, 10, 'a', 'b'); + assert(false); + } + catch (std::invalid_argument&) + { + } } - } - +#endif // TEST_HAS_NO_EXCEPTIONS { - std::string str("xxx1010101010xxxx"); - std::bitset<N> v(str, 3, 10); - std::size_t M = std::min<std::size_t>(N, 10); - for (std::size_t i = 0; i < M; ++i) - assert(v[i] == (str[3 + M - 1 - i] == '1')); - for (std::size_t i = 10; i < N; ++i) - assert(v[i] == false); + std::string str("xxx1010101010xxxx"); + std::bitset<N> v(str, 3, 10); + std::size_t M = std::min<std::size_t>(N, 10); + for (std::size_t i = 0; i < M; ++i) + assert(v[i] == (str[3 + M - 1 - i] == '1')); + for (std::size_t i = 10; i < N; ++i) + assert(v[i] == false); } - - { - try { std::string str("xxxbababababaxxxx"); - std::bitset<N> v(str, 2, 10, 'a', 'b'); - assert(false); - } - catch (std::invalid_argument&) - { - } - } - - { - std::string str("xxxbababababaxxxx"); - std::bitset<N> v(str, 3, 10, 'a', 'b'); - std::size_t M = std::min<std::size_t>(N, 10); - for (std::size_t i = 0; i < M; ++i) - assert(v[i] == (str[3 + M - 1 - i] == 'b')); - for (std::size_t i = 10; i < N; ++i) - assert(v[i] == false); + std::bitset<N> v(str, 3, 10, 'a', 'b'); + std::size_t M = std::min<std::size_t>(N, 10); + for (std::size_t i = 0; i < M; ++i) + assert(v[i] == (str[3 + M - 1 - i] == 'b')); + for (std::size_t i = 10; i < N; ++i) + assert(v[i] == false); } } |