1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // template<class InputIterator>
14 // seed_seq(InputIterator begin, InputIterator end);
19 #include "test_macros.h"
24 unsigned a
[5] = {5, 4, 3, 2, 1};
25 std::seed_seq
s(a
, a
+5);
26 assert(s
.size() == 5);
37 // Test truncation to 32 bits
38 unsigned long long a
[4] = {
39 0x1234000056780000uLL
,
40 0x0000001234567800uLL
,
41 0xFFFFFFFFFFFFFFFFuLL
,
42 0x0000000180000000uLL
,
44 std::seed_seq
s(a
, a
+4);
45 assert(s
.size() == 4);
49 assert(b
[0] == 0x56780000u
);
50 assert(b
[1] == 0x34567800u
);
51 assert(b
[2] == 0xFFFFFFFFu
);
52 assert(b
[3] == 0x80000000u
);
54 #if TEST_STD_VER >= 11
56 // Test uniform initialization syntax (LWG 3422)
57 unsigned a
[3] = {1, 2, 3};
58 std::seed_seq s
{a
, a
+3}; // uniform initialization
59 assert(s
.size() == 3);
67 #endif // TEST_STD_VER >= 11