summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/strings/string.conversions/stold.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/strings/string.conversions/stold.pass.cpp')
-rw-r--r--libcxx/test/std/strings/string.conversions/stold.pass.cpp25
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
}
OpenPOWER on IntegriCloud