]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 26_numerics / random / negative_binomial_distribution / operators / values.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
113b21bd
PC
2// { dg-require-cstdint "" }
3// { dg-require-cmath "" }
4//
a5544970 5// Copyright (C) 2011-2019 Free Software Foundation, Inc.
113b21bd
PC
6//
7// This file is part of the GNU ISO C++ Library. This library is free
8// software; you can redistribute it and/or modify it under the
9// terms of the GNU General Public License as published by the
10// Free Software Foundation; either version 3, or (at your option)
11// any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License along
19// with this library; see the file COPYING3. If not see
20// <http://www.gnu.org/licenses/>.
21
22// 26.5.8.3.4 Class template negative_binomial_distribution
23// [rand.dist.bern.negbin]
24
25#include <random>
26#include <functional>
27#include <testsuite_random.h>
28
29void test01()
30{
31 using namespace __gnu_test;
32
33 std::mt19937 eng;
34
35 std::negative_binomial_distribution<> nbd1(5, 0.3);
36 auto bnbd1 = std::bind(nbd1, eng);
37 testDiscreteDist(bnbd1, [](int n)
38 { return negative_binomial_pdf(n, 5, 0.3); } );
39
40 std::negative_binomial_distribution<> nbd2(55, 0.3);
41 auto bnbd2 = std::bind(nbd2, eng);
42 testDiscreteDist(bnbd2, [](int n)
43 { return negative_binomial_pdf(n, 55, 0.3); } );
44
45 std::negative_binomial_distribution<> nbd3(10, 0.75);
46 auto bnbd3 = std::bind(nbd3, eng);
47 testDiscreteDist(bnbd3, [](int n)
48 { return negative_binomial_pdf(n, 10, 0.75); } );
49}
50
51int main()
52{
53 test01();
54 return 0;
55}