1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // XFAIL: libcpp-no-exceptions
11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
12 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
16 // unsigned long stoul(const string& str, size_t *idx = 0, int base = 10);
17 // unsigned long stoul(const wstring& str, size_t *idx = 0, int base = 10);
24 assert(std::stoul("0") == 0);
25 assert(std::stoul(L"0") == 0);
26 assert(std::stoul("-0") == 0);
27 assert(std::stoul(L"-0") == 0);
28 assert(std::stoul(" 10") == 10);
29 assert(std::stoul(L" 10") == 10);
31 assert(std::stoul("10g", &idx, 16) == 16);
34 assert(std::stoul(L"10g", &idx, 16) == 16);
42 catch (const std::invalid_argument&)
48 std::stoul(L"", &idx);
51 catch (const std::invalid_argument&)
57 std::stoul(" - 8", &idx);
60 catch (const std::invalid_argument&)
66 std::stoul(L" - 8", &idx);
69 catch (const std::invalid_argument&)
75 std::stoul("a1", &idx);
78 catch (const std::invalid_argument&)
84 std::stoul(L"a1", &idx);
87 catch (const std::invalid_argument&)
94 std::stoul("9999999999999999999999999999999999999999999999999", &idx);
97 catch (const std::out_of_range&)
103 std::stoul(L"9999999999999999999999999999999999999999999999999", &idx);
106 catch (const std::out_of_range&)