diff options
Diffstat (limited to 'test/std/strings/string.conversions')
8 files changed, 84 insertions, 8 deletions
diff --git a/test/std/strings/string.conversions/stod.pass.cpp b/test/std/strings/string.conversions/stod.pass.cpp index 27d5e5cbd19b4..3d5db63e09833 100644 --- a/test/std/strings/string.conversions/stod.pass.cpp +++ b/test/std/strings/string.conversions/stod.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // <string> // double stod(const string& str, size_t *idx = 0); @@ -17,6 +16,8 @@ #include <cmath> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stod("0") == 0); @@ -33,20 +34,25 @@ int main() idx = 0; assert(std::stod(L"10g", &idx) == 10); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::stod("1.e60", &idx) == 1.e60); assert(idx == 5); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } try +#endif { assert(std::stod(L"1.e60", &idx) == 1.e60); assert(idx == 5); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); @@ -71,40 +77,54 @@ int main() assert(idx == 0); } try +#endif { assert(std::stod("INF", &idx) == INFINITY); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::stod(L"INF", &idx) == INFINITY); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::isnan(std::stod("NAN", &idx))); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::isnan(std::stod(L"NAN", &idx))); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); @@ -164,4 +184,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp index 38519a2feba0f..1e17e1d3abdda 100644 --- a/test/std/strings/string.conversions/stof.pass.cpp +++ b/test/std/strings/string.conversions/stof.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 @@ -20,6 +19,8 @@ #include <cmath> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stof("0") == 0); @@ -36,6 +37,7 @@ int main() idx = 0; assert(std::stof(L"10g", &idx) == 10); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS idx = 0; try { @@ -75,40 +77,54 @@ int main() assert(idx == 0); } try +#endif { assert(std::stof("INF", &idx) == INFINITY); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::stof(L"INF", &idx) == INFINITY); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::isnan(std::stof("NAN", &idx))); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::isnan(std::stof(L"NAN", &idx))); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); @@ -168,4 +184,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stoi.pass.cpp b/test/std/strings/string.conversions/stoi.pass.cpp index 2380727407032..8852d47f00112 100644 --- a/test/std/strings/string.conversions/stoi.pass.cpp +++ b/test/std/strings/string.conversions/stoi.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // <string> // int stoi(const string& str, size_t *idx = 0, int base = 10); @@ -16,6 +15,8 @@ #include <string> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stoi("0") == 0); @@ -32,6 +33,7 @@ int main() idx = 0; assert(std::stoi(L"10g", &idx, 16) == 16); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS if (std::numeric_limits<long>::max() > std::numeric_limits<int>::max()) { try @@ -106,4 +108,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp index 2ca2c01cfb8c5..457cf0a769979 100644 --- a/test/std/strings/string.conversions/stol.pass.cpp +++ b/test/std/strings/string.conversions/stol.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 @@ -19,6 +18,8 @@ #include <string> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stol("0") == 0); @@ -35,6 +36,7 @@ int main() idx = 0; assert(std::stol(L"10g", &idx, 16) == 16); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS idx = 0; try { @@ -109,4 +111,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stold.pass.cpp b/test/std/strings/string.conversions/stold.pass.cpp index f489df2f124da..9d9dc3832ba68 100644 --- a/test/std/strings/string.conversions/stold.pass.cpp +++ b/test/std/strings/string.conversions/stold.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // <string> // long double stold(const string& str, size_t *idx = 0); @@ -19,6 +18,8 @@ #include <cmath> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stold("0") == 0); @@ -35,25 +36,32 @@ int main() idx = 0; assert(std::stold(L"10g", &idx) == 10); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::stold("1.e60", &idx) == 1.e60L); assert(idx == 5); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } try +#endif { assert(std::stold(L"1.e60", &idx) == 1.e60L); assert(idx == 5); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try { assert(std::stold("1.e6000", &idx) == INFINITY); @@ -73,40 +81,54 @@ int main() assert(idx == 0); } try +#endif { assert(std::stold("INF", &idx) == INFINITY); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::stold(L"INF", &idx) == INFINITY); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::isnan(std::stold("NAN", &idx))); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); } +#endif idx = 0; +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { assert(std::isnan(std::stold(L"NAN", &idx))); assert(idx == 3); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (const std::out_of_range&) { assert(false); @@ -166,4 +188,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp index d41db4284acdd..ca8412aeb7583 100644 --- a/test/std/strings/string.conversions/stoll.pass.cpp +++ b/test/std/strings/string.conversions/stoll.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 @@ -19,6 +18,8 @@ #include <string> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stoll("0") == 0); @@ -35,6 +36,7 @@ int main() idx = 0; assert(std::stoll(L"10g", &idx, 16) == 16); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS idx = 0; try { @@ -108,4 +110,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp index 9dbd952434a9b..1acdf116458f1 100644 --- a/test/std/strings/string.conversions/stoul.pass.cpp +++ b/test/std/strings/string.conversions/stoul.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 @@ -19,6 +18,8 @@ #include <string> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stoul("0") == 0); @@ -33,6 +34,7 @@ int main() idx = 0; assert(std::stoul(L"10g", &idx, 16) == 16); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS idx = 0; try { @@ -107,4 +109,5 @@ int main() { assert(idx == 0); } +#endif } diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp index 837ca31201000..e63679eed2f4d 100644 --- a/test/std/strings/string.conversions/stoull.pass.cpp +++ b/test/std/strings/string.conversions/stoull.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: libcpp-no-exceptions // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 @@ -19,6 +18,8 @@ #include <string> #include <cassert> +#include "test_macros.h" + int main() { assert(std::stoull("0") == 0); @@ -33,6 +34,7 @@ int main() idx = 0; assert(std::stoull(L"10g", &idx, 16) == 16); assert(idx == 2); +#ifndef TEST_HAS_NO_EXCEPTIONS idx = 0; try { @@ -108,4 +110,5 @@ int main() { assert(idx == 0); } +#endif } |