51 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <random>10 11// template<class RealType = double>12// class piecewise_constant_distribution13 14// bool operator=(const piecewise_constant_distribution& x,15// const piecewise_constant_distribution& y);16// bool operator!(const piecewise_constant_distribution& x,17// const piecewise_constant_distribution& y);18 19#include <random>20#include <cassert>21 22#include "test_macros.h"23 24int main(int, char**)25{26 {27 typedef std::piecewise_constant_distribution<> D;28 D d1;29 D d2;30 assert(d1 == d2);31 }32 {33 typedef std::piecewise_constant_distribution<> D;34 double b[] = {10, 14, 16, 17};35 double p[] = {25, 62.5, 12.5};36 D d1(b, b+4, p);37 D d2(b, b+4, p);38 assert(d1 == d2);39 }40 {41 typedef std::piecewise_constant_distribution<> D;42 double b[] = {10, 14, 16, 17};43 double p[] = {25, 62.5, 12.5};44 D d1(b, b+4, p);45 D d2;46 assert(d1 != d2);47 }48 49 return 0;50}51