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 | // UNSUPPORTED: c++03 |
10 | |
11 | // <random> |
12 | |
13 | // template<class RealType = double> |
14 | // class piecewise_constant_distribution |
15 | |
16 | // piecewise_constant_distribution(initializer_list<double> wl); |
17 | |
18 | #include <random> |
19 | |
20 | #include <cassert> |
21 | #include <vector> |
22 | |
23 | #include "test_macros.h" |
24 | |
25 | int main(int, char**) |
26 | { |
27 | { |
28 | typedef std::piecewise_constant_distribution<> D; |
29 | D d; |
30 | std::vector<double> iv = d.intervals(); |
31 | assert(iv.size() == 2); |
32 | assert(iv[0] == 0); |
33 | assert(iv[1] == 1); |
34 | std::vector<double> dn = d.densities(); |
35 | assert(dn.size() == 1); |
36 | assert(dn[0] == 1); |
37 | } |
38 | |
39 | return 0; |
40 | } |
41 | |