[libcxx] r286812 - Update tests for strings conversions under libcpp-no-exceptions

Roger Ferrer Ibanez via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 02:44:27 PST 2016


Author: rogfer01
Date: Mon Nov 14 04:44:26 2016
New Revision: 286812

URL: http://llvm.org/viewvc/llvm-project?rev=286812&view=rev
Log:
Update tests for strings conversions under libcpp-no-exceptions

Differential Revision: https://reviews.llvm.org/D26139


Modified:
    libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stold.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stoul.pass.cpp
    libcxx/trunk/test/std/strings/string.conversions/stoull.pass.cpp

Modified: libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stod.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stof.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stoi.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stol.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stold.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stold.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stold.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stold.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stoll.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stoul.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stoul.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stoul.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stoul.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }

Modified: libcxx/trunk/test/std/strings/string.conversions/stoull.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/string.conversions/stoull.pass.cpp?rev=286812&r1=286811&r2=286812&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/string.conversions/stoull.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/string.conversions/stoull.pass.cpp Mon Nov 14 04:44:26 2016
@@ -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
 }




More information about the cfe-commits mailing list