[libcxx] r188282 - Added more tests for numeric conversion error handing; Refs LWG issue 2009

Marshall Clow mclow.lists at gmail.com
Tue Aug 13 08:52:51 PDT 2013


Author: marshall
Date: Tue Aug 13 10:52:51 2013
New Revision: 188282

URL: http://llvm.org/viewvc/llvm-project?rev=188282&view=rev
Log:
Added more tests for numeric conversion error handing; Refs LWG issue 2009

Modified:
    libcxx/trunk/test/strings/string.conversions/stol.pass.cpp
    libcxx/trunk/test/strings/string.conversions/stoll.pass.cpp
    libcxx/trunk/test/strings/string.conversions/stoul.pass.cpp
    libcxx/trunk/test/strings/string.conversions/stoull.pass.cpp

Modified: libcxx/trunk/test/strings/string.conversions/stol.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/strings/string.conversions/stol.pass.cpp?rev=188282&r1=188281&r2=188282&view=diff
==============================================================================
--- libcxx/trunk/test/strings/string.conversions/stol.pass.cpp (original)
+++ libcxx/trunk/test/strings/string.conversions/stol.pass.cpp Tue Aug 13 10:52:51 2013
@@ -86,4 +86,23 @@ int main()
     {
         assert(idx == 0);
     }
+//	LWG issue #2009
+    try
+    {
+        std::stol("9999999999999999999999999999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
+    try
+    {
+        std::stol(L"9999999999999999999999999999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
 }

Modified: libcxx/trunk/test/strings/string.conversions/stoll.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/strings/string.conversions/stoll.pass.cpp?rev=188282&r1=188281&r2=188282&view=diff
==============================================================================
--- libcxx/trunk/test/strings/string.conversions/stoll.pass.cpp (original)
+++ libcxx/trunk/test/strings/string.conversions/stoll.pass.cpp Tue Aug 13 10:52:51 2013
@@ -98,4 +98,13 @@ int main()
     {
         assert(idx == 0);
     }
+    try
+    {
+        std::stoll(L"99999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
 }

Modified: libcxx/trunk/test/strings/string.conversions/stoul.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/strings/string.conversions/stoul.pass.cpp?rev=188282&r1=188281&r2=188282&view=diff
==============================================================================
--- libcxx/trunk/test/strings/string.conversions/stoul.pass.cpp (original)
+++ libcxx/trunk/test/strings/string.conversions/stoul.pass.cpp Tue Aug 13 10:52:51 2013
@@ -84,4 +84,23 @@ int main()
     {
         assert(idx == 0);
     }
+//	LWG issue #2009
+    try
+    {
+        std::stoul("9999999999999999999999999999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
+    try
+    {
+        std::stoul(L"9999999999999999999999999999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
 }

Modified: libcxx/trunk/test/strings/string.conversions/stoull.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/strings/string.conversions/stoull.pass.cpp?rev=188282&r1=188281&r2=188282&view=diff
==============================================================================
--- libcxx/trunk/test/strings/string.conversions/stoull.pass.cpp (original)
+++ libcxx/trunk/test/strings/string.conversions/stoull.pass.cpp Tue Aug 13 10:52:51 2013
@@ -85,4 +85,23 @@ int main()
     {
         assert(idx == 0);
     }
+//	LWG issue #2009
+    try
+    {
+        std::stoull("9999999999999999999999999999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
+    try
+    {
+        std::stoull(L"9999999999999999999999999999999999999999999999999", &idx);
+        assert(false);
+    }
+    catch (const std::out_of_range&)
+    {
+        assert(idx == 0);
+    }
 }





More information about the cfe-commits mailing list