diff options
author | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2016-11-14 10:44:26 +0000 |
---|---|---|
committer | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2016-11-14 10:44:26 +0000 |
commit | 84c152a130ff95e52846dddd2cc6ad1c31648160 (patch) | |
tree | 983f440031c3cbd0dbca231037cb36fc2b08311a /libcxx/test/std/strings/string.conversions/stold.pass.cpp | |
parent | 3d8482a88d5a3a43ef251e642b352fb1e4505335 (diff) | |
download | bcm5719-llvm-84c152a130ff95e52846dddd2cc6ad1c31648160.tar.gz bcm5719-llvm-84c152a130ff95e52846dddd2cc6ad1c31648160.zip |
Update tests for strings conversions under libcpp-no-exceptions
Differential Revision: https://reviews.llvm.org/D26139
llvm-svn: 286812
Diffstat (limited to 'libcxx/test/std/strings/string.conversions/stold.pass.cpp')
-rw-r--r-- | libcxx/test/std/strings/string.conversions/stold.pass.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libcxx/test/std/strings/string.conversions/stold.pass.cpp b/libcxx/test/std/strings/string.conversions/stold.pass.cpp index f489df2f124..9d9dc3832ba 100644 --- a/libcxx/test/std/strings/string.conversions/stold.pass.cpp +++ b/libcxx/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 } |