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 // long stol(const string& str, size_t *idx = 0, int base = 10);
16 // long stol(const wstring& str, size_t *idx = 0, int base = 10);
23 assert(std::stol("0") == 0);
24 assert(std::stol(L
"0") == 0);
25 assert(std::stol("-0") == 0);
26 assert(std::stol(L
"-0") == 0);
27 assert(std::stol("-10") == -10);
28 assert(std::stol(L
"-10") == -10);
29 assert(std::stol(" 10") == 10);
30 assert(std::stol(L
" 10") == 10);
32 assert(std::stol("10g", &idx
, 16) == 16);
35 assert(std::stol(L
"10g", &idx
, 16) == 16);
43 catch (const std::invalid_argument
&)
52 catch (const std::invalid_argument
&)
58 std::stol(" - 8", &idx
);
61 catch (const std::invalid_argument
&)
67 std::stol(L
" - 8", &idx
);
70 catch (const std::invalid_argument
&)
76 std::stol("a1", &idx
);
79 catch (const std::invalid_argument
&)
85 std::stol(L
"a1", &idx
);
88 catch (const std::invalid_argument
&)
95 std::stol("9999999999999999999999999999999999999999999999999", &idx
);
98 catch (const std::out_of_range
&)
104 std::stol(L
"9999999999999999999999999999999999999999999999999", &idx
);
107 catch (const std::out_of_range
&)