Added more tests for numeric conversion error handing; Refs LWG issue 2009
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188282 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6b229e1ad1
commit
8634fc5494
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user