1//===----------------------------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9// <random>
10
11// template <class UIntType, size_t w, size_t n, size_t m, size_t r,
12// UIntType a, size_t u, UIntType d, size_t s,
13// UIntType b, size_t t, UIntType c, size_t l, UIntType f>
14// class mersenne_twister_engine;
15
16// mersenne_twister_engine(const mersenne_twister_engine&);
17
18#include <random>
19#include <cassert>
20
21#include "test_macros.h"
22
23void
24test1()
25{
26 typedef std::mt19937 E;
27 E e1;
28 (void)e1();
29 E e2 = e1;
30 assert(e1 == e2);
31 assert(e1() == e2());
32 E::result_type k = e1();
33 assert(e1 != e2);
34 assert(e2() == k);
35 assert(e1 == e2);
36}
37
38void
39test2()
40{
41 typedef std::mt19937_64 E;
42 E e1;
43 (void)e1();
44 E e2(e1);
45 assert(e1 == e2);
46 assert(e1() == e2());
47 E::result_type k = e1();
48 assert(e1 != e2);
49 assert(e2() == k);
50 assert(e1 == e2);
51}
52
53int main(int, char**)
54{
55 test1();
56 test2();
57
58 return 0;
59}
60

source code of libcxx/test/std/numerics/rand/rand.eng/rand.eng.mers/copy.pass.cpp