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_cxx_lib=x86_64-apple-darwin11
11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
15 // unsigned long long stoull(const string& str, size_t *idx = 0, int base = 10);
16 // unsigned long long stoull(const wstring& str, size_t *idx = 0, int base = 10);
21 #include "test_macros.h"
25 assert(std::stoull("0") == 0);
26 assert(std::stoull(L"0") == 0);
27 assert(std::stoull("-0") == 0);
28 assert(std::stoull(L"-0") == 0);
29 assert(std::stoull(" 10") == 10);
30 assert(std::stoull(L" 10") == 10);
32 assert(std::stoull("10g", &idx, 16) == 16);
35 assert(std::stoull(L"10g", &idx, 16) == 16);
37 #ifndef TEST_HAS_NO_EXCEPTIONS
41 std::stoull("", &idx);
44 catch (const std::invalid_argument&)
51 std::stoull(L"", &idx);
54 catch (const std::invalid_argument&)
60 std::stoull(" - 8", &idx);
63 catch (const std::invalid_argument&)
69 std::stoull(L" - 8", &idx);
72 catch (const std::invalid_argument&)
78 std::stoull("a1", &idx);
81 catch (const std::invalid_argument&)
87 std::stoull(L"a1", &idx);
90 catch (const std::invalid_argument&)
97 std::stoull("9999999999999999999999999999999999999999999999999", &idx);
100 catch (const std::out_of_range&)
106 std::stoull(L"9999999999999999999999999999999999999999999999999", &idx);
109 catch (const std::out_of_range&)