summaryrefslogtreecommitdiff
path: root/test/std/strings/string.conversions/stod.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/strings/string.conversions/stod.pass.cpp')
-rw-r--r--test/std/strings/string.conversions/stod.pass.cpp23
1 files changed, 22 insertions, 1 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
}