mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
Update tests for strings conversions under libcpp-no-exceptions
Differential Revision: https://reviews.llvm.org/D26139 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286812 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user