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: with_system_lib=x86_64-apple-darwin11
11 // XFAIL: with_system_lib=x86_64-apple-darwin12
15 // unsigned long stoul(const string& str, size_t *idx = 0, int base = 10);
16 // unsigned long stoul(const wstring& str, size_t *idx = 0, int base = 10);
23 assert(std::stoul("0") == 0);
24 assert(std::stoul(L
"0") == 0);
25 assert(std::stoul("-0") == 0);
26 assert(std::stoul(L
"-0") == 0);
27 assert(std::stoul(" 10") == 10);
28 assert(std::stoul(L
" 10") == 10);
30 assert(std::stoul("10g", &idx
, 16) == 16);
33 assert(std::stoul(L
"10g", &idx
, 16) == 16);
41 catch (const std::invalid_argument
&)
47 std::stoul(L
"", &idx
);
50 catch (const std::invalid_argument
&)
56 std::stoul(" - 8", &idx
);
59 catch (const std::invalid_argument
&)
65 std::stoul(L
" - 8", &idx
);
68 catch (const std::invalid_argument
&)
74 std::stoul("a1", &idx
);
77 catch (const std::invalid_argument
&)
83 std::stoul(L
"a1", &idx
);
86 catch (const std::invalid_argument
&)
93 std::stoul("9999999999999999999999999999999999999999999999999", &idx
);
96 catch (const std::out_of_range
&)
102 std::stoul(L
"9999999999999999999999999999999999999999999999999", &idx
);
105 catch (const std::out_of_range
&)