xref: /llvm-project/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.discrete/eq.pass.cpp (revision eb1c50378e73f3e05678633b3d2b4b7b23d5e709)
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 IntType = int>
12 // class discrete_distribution
13 
14 // bool operator=(const discrete_distribution& x,
15 //                const discrete_distribution& y);
16 // bool operator!(const discrete_distribution& x,
17 //                const discrete_distribution& y);
18 
19 #include <random>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 
main(int,char **)24 int main(int, char**)
25 {
26     {
27         typedef std::discrete_distribution<> D;
28         D d1;
29         D d2;
30         assert(d1 == d2);
31     }
32     {
33         typedef std::discrete_distribution<> D;
34         double p0[] = {1};
35         D d1(p0, p0+1);
36         D d2;
37         assert(d1 == d2);
38     }
39     {
40         typedef std::discrete_distribution<> D;
41         double p0[] = {10, 30};
42         D d1(p0, p0+2);
43         D d2;
44         assert(d1 != d2);
45     }
46 
47   return 0;
48 }
49