summaryrefslogtreecommitdiff
path: root/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli')
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp33
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp31
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp103
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp107
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp28
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp40
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp26
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp26
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp30
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp34
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp36
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp27
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp29
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp26
18 files changed, 705 insertions, 0 deletions
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp
new file mode 100644
index 0000000000000..e55c1579c4cb2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/assign.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// bernoulli_distribution& operator=(const bernoulli_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::bernoulli_distribution D;
+ D d1(0.75);
+ D d2;
+ assert(d1 != d2);
+ d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp
new file mode 100644
index 0000000000000..c64f925b4c6b2
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/copy.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// bernoulli_distribution(const bernoulli_distribution&);
+
+#include <random>
+#include <cassert>
+
+void
+test1()
+{
+ typedef std::bernoulli_distribution D;
+ D d1(0.75);
+ D d2 = d1;
+ assert(d1 == d2);
+}
+
+int main()
+{
+ test1();
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp
new file mode 100644
index 0000000000000..5d511fcc67395
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_double.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// explicit bernoulli_distribution(double p = 0.5);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d;
+ assert(d.p() == 0.5);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ D d(0);
+ assert(d.p() == 0);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ D d(0.75);
+ assert(d.p() == 0.75);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp
new file mode 100644
index 0000000000000..a143b5a68f4cc
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/ctor_param.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// explicit bernoulli_distribution(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(p);
+ assert(d.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp
new file mode 100644
index 0000000000000..b77c12eed22ee
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eq.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// bool operator=(const bernoulli_distribution& x,
+// const bernoulli_distribution& y);
+// bool operator!(const bernoulli_distribution& x,
+// const bernoulli_distribution& y);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d1(.25);
+ D d2(.25);
+ assert(d1 == d2);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ D d1(.28);
+ D d2(.25);
+ assert(d1 != d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
new file mode 100644
index 0000000000000..f071e85074788
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.75);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.p();
+ double x_var = d.p()*(1-d.p());
+ double x_skew = (1 - 2 * d.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(d.p()) - 6 * d.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = d.p();
+ double x_var = d.p()*(1-d.p());
+ double x_skew = (1 - 2 * d.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(d.p()) - 6 * d.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
new file mode 100644
index 0000000000000..e03fb57f380ca
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
+
+#include <random>
+#include <numeric>
+#include <vector>
+#include <cassert>
+
+template <class T>
+inline
+T
+sqr(T x)
+{
+ return x * x;
+}
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.75);
+ P p(.25);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.p();
+ double x_var = p.p()*(1-p.p());
+ double x_skew = (1 - 2 * p.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(p.p()) - 6 * p.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ typedef std::minstd_rand G;
+ G g;
+ D d(.25);
+ P p(.75);
+ const int N = 100000;
+ std::vector<D::result_type> u;
+ for (int i = 0; i < N; ++i)
+ u.push_back(d(g, p));
+ double mean = std::accumulate(u.begin(), u.end(),
+ double(0)) / u.size();
+ double var = 0;
+ double skew = 0;
+ double kurtosis = 0;
+ for (int i = 0; i < u.size(); ++i)
+ {
+ double d = (u[i] - mean);
+ double d2 = sqr(d);
+ var += d2;
+ skew += d * d2;
+ kurtosis += d2 * d2;
+ }
+ var /= u.size();
+ double dev = std::sqrt(var);
+ skew /= u.size() * dev * var;
+ kurtosis /= u.size() * var * var;
+ kurtosis -= 3;
+ double x_mean = p.p();
+ double x_var = p.p()*(1-p.p());
+ double x_skew = (1 - 2 * p.p())/std::sqrt(x_var);
+ double x_kurtosis = (6 * sqr(p.p()) - 6 * p.p() + 1)/x_var;
+ assert(std::abs((mean - x_mean) / x_mean) < 0.01);
+ assert(std::abs((var - x_var) / x_var) < 0.01);
+ assert(std::abs((skew - x_skew) / x_skew) < 0.01);
+ assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.02);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp
new file mode 100644
index 0000000000000..1b4eae90b6a3a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/get_param.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// param_type param() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ P p(.125);
+ D d(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp
new file mode 100644
index 0000000000000..5f57145e13119
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/io.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// template <class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const bernoulli_distribution& x);
+//
+// template <class charT, class traits>
+// basic_istream<charT, traits>&
+// operator>>(basic_istream<charT, traits>& is,
+// bernoulli_distribution& x);
+
+#include <random>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d1(.25);
+ std::ostringstream os;
+ os << d1;
+ std::istringstream is(os.str());
+ D d2;
+ is >> d2;
+ assert(d1 == d2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp
new file mode 100644
index 0000000000000..8e669bbda34a4
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/max.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// result_type max() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d(.25);
+ assert(d.max() == true);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp
new file mode 100644
index 0000000000000..296ad1474ecf1
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/min.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// result_type min() const;
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ D d(.5);
+ assert(d.min() == false);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp
new file mode 100644
index 0000000000000..a24dd0dfc9303
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_assign.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p0(.7);
+ param_type p;
+ p = p0;
+ assert(p.p() == .7);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp
new file mode 100644
index 0000000000000..6c4eaeee4da95
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_copy.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p0(.125);
+ param_type p = p0;
+ assert(p.p() == .125);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp
new file mode 100644
index 0000000000000..c43f44721a608
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_ctor.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p;
+ assert(p.p() == 0.5);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p(0.25);
+ assert(p.p() == 0.25);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp
new file mode 100644
index 0000000000000..ee5dfe867b7e9
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_eq.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <limits>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.75);
+ assert(p1 == p2);
+ }
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ param_type p1(0.75);
+ param_type p2(0.5);
+ assert(p1 != p2);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp
new file mode 100644
index 0000000000000..5a3b90332120a
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/param_types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// class param_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type param_type;
+ typedef param_type::distribution_type distribution_type;
+ static_assert((std::is_same<D, distribution_type>::value), "");
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp
new file mode 100644
index 0000000000000..9869ac6fc39c3
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/set_param.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+
+// void param(const param_type& parm);
+
+#include <random>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::param_type P;
+ P p(0.25);
+ D d(0.75);
+ d.param(p);
+ assert(d.param() == p);
+ }
+}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp
new file mode 100644
index 0000000000000..4b6c4be1a2400
--- /dev/null
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// class bernoulli_distribution
+// {
+// typedef bool result_type;
+
+#include <random>
+#include <type_traits>
+
+int main()
+{
+ {
+ typedef std::bernoulli_distribution D;
+ typedef D::result_type result_type;
+ static_assert((std::is_same<result_type, bool>::value), "");
+ }
+}