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