diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-05-18 17:32:30 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-05-18 17:32:30 +0000 |
commit | e31e36f9109a77fba5beffceedfa1f1172c669b6 (patch) | |
tree | 522eb1f7d7e24f05f653ea966a086dd62acde2af /libcxx/test | |
parent | 4843178d6bd2083b88908ada581188c2b7aa226a (diff) | |
download | bcm5719-llvm-e31e36f9109a77fba5beffceedfa1f1172c669b6.tar.gz bcm5719-llvm-e31e36f9109a77fba5beffceedfa1f1172c669b6.zip |
[rand.dist.norm.f]
llvm-svn: 104035
Diffstat (limited to 'libcxx/test')
18 files changed, 745 insertions, 0 deletions
diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp new file mode 100644 index 00000000000..57d1270fec4 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// fisher_f_distribution& operator=(const fisher_f_distribution&); + +#include <random> +#include <cassert> + +void +test1() +{ + typedef std::fisher_f_distribution<> D; + D d1(20, 0.75); + D d2; + assert(d1 != d2); + d2 = d1; + assert(d1 == d2); +} + +int main() +{ + test1(); +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp new file mode 100644 index 00000000000..128325f05b4 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// fisher_f_distribution(const fisher_f_distribution&); + +#include <random> +#include <cassert> + +void +test1() +{ + typedef std::fisher_f_distribution<> D; + D d1(20, 1.75); + D d2 = d1; + assert(d1 == d2); +} + +int main() +{ + test1(); +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp new file mode 100644 index 00000000000..c496a886f55 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// explicit fisher_f_distribution(result_type alpha = 0, result_type beta = 1); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d; + assert(d.m() == 1); + assert(d.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + D d(14.5); + assert(d.m() == 14.5); + assert(d.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + D d(14.5, 5.25); + assert(d.m() == 14.5); + assert(d.n() == 5.25); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp new file mode 100644 index 00000000000..c6d0a9c15c6 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// explicit fisher_f_distribution(const param_type& parm); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + P p(0.25, 10); + D d(p); + assert(d.m() == 0.25); + assert(d.n() == 10); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp new file mode 100644 index 00000000000..352ddbc1e3e --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// bool operator=(const fisher_f_distribution& x, +// const fisher_f_distribution& y); +// bool operator!(const fisher_f_distribution& x, +// const fisher_f_distribution& y); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d1(2.5, 4); + D d2(2.5, 4); + assert(d1 == d2); + } + { + typedef std::fisher_f_distribution<> D; + D d1(2.5, 4); + D d2(2.5, 4.5); + assert(d1 != d2); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp new file mode 100644 index 00000000000..4352f577aa7 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp @@ -0,0 +1,104 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// template<class _URNG> result_type operator()(_URNG& g); + +#include <random> +#include <cassert> +#include <vector> +#include <algorithm> +#include <cmath> + +double fac(double x) +{ + double r = 1; + for (; x > 1; --x) + r *= x; + return r; +} + +double +I(double x, unsigned a, unsigned b) +{ + double r = 0; + for (int j = a; j <= a+b-1; ++j) + r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) * + std::pow(1-x, a+b-1-j); + return r; +} + +double +f(double x, double m, double n) +{ + return I(m * x / (m*x + n), static_cast<unsigned>(m/2), static_cast<unsigned>(n/2)); +} + +int main() +{ + // Purposefully only testing even integral values of m and n (for now) + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(2, 4); + const int N = 100000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(4, 2); + const int N = 100000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(18, 20); + const int N = 100000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp new file mode 100644 index 00000000000..e9ad52f1811 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp @@ -0,0 +1,107 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm); + +#include <random> +#include <cassert> +#include <vector> +#include <algorithm> +#include <cmath> + +double fac(double x) +{ + double r = 1; + for (; x > 1; --x) + r *= x; + return r; +} + +double +I(double x, unsigned a, unsigned b) +{ + double r = 0; + for (int j = a; j <= a+b-1; ++j) + r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) * + std::pow(1-x, a+b-1-j); + return r; +} + +double +f(double x, double m, double n) +{ + return I(m * x / (m*x + n), static_cast<unsigned>(m/2), static_cast<unsigned>(n/2)); +} + +int main() +{ + // Purposefully only testing even integral values of m and n (for now) + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(2, 4); + P p(4, 2); + const int N = 100000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(4, 2); + P p(6, 8); + const int N = 100000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(18, 20); + P p(16, 14); + const int N = 100000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp new file mode 100644 index 00000000000..af7f70f0460 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// param_type param() const; + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + P p(.125, .5); + D d(p); + assert(d.param() == p); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp new file mode 100644 index 00000000000..66d3b274034 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// template <class CharT, class Traits, class RealType> +// basic_ostream<CharT, Traits>& +// operator<<(basic_ostream<CharT, Traits>& os, +// const fisher_f_distribution<RealType>& x); + +// template <class CharT, class Traits, class RealType> +// basic_istream<CharT, Traits>& +// operator>>(basic_istream<CharT, Traits>& is, +// fisher_f_distribution<RealType>& x); + +#include <random> +#include <sstream> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d1(7, 5); + std::ostringstream os; + os << d1; + std::istringstream is(os.str()); + D d2; + is >> d2; + assert(d1 == d2); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp new file mode 100644 index 00000000000..a388d15be61 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// result_type max() const; + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d(5, .25); + D::result_type m = d.max(); + assert(m == INFINITY); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp new file mode 100644 index 00000000000..7e7aae6b996 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution + +// result_type min() const; + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d(.5, .5); + assert(d.min() == 0); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp new file mode 100644 index 00000000000..b335b1fbe44 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p0(.75, 6); + param_type p; + p = p0; + assert(p.m() == .75); + assert(p.n() == 6); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp new file mode 100644 index 00000000000..37539b6bdde --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p0(10, .125); + param_type p = p0; + assert(p.m() == 10); + assert(p.n() == .125); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp new file mode 100644 index 00000000000..90ac5373088 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p; + assert(p.m() == 1); + assert(p.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p(10); + assert(p.m() == 10); + assert(p.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p(10, 5); + assert(p.m() == 10); + assert(p.n() == 5); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp new file mode 100644 index 00000000000..d2b16ba3255 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p1(0.75, .5); + param_type p2(0.75, .5); + assert(p1 == p2); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p1(0.75, .5); + param_type p2(0.5, .5); + assert(p1 != p2); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp new file mode 100644 index 00000000000..3649c8fc7d7 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution +// { +// class param_type; + +#include <random> +#include <type_traits> + +int main() +{ + { + typedef std::fisher_f_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/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp new file mode 100644 index 00000000000..a0f1be0aa0d --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution; + +// void param(const param_type& parm); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + P p(0.25, 5.5); + D d(0.75, 4); + d.param(p); + assert(d.param() == p); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp new file mode 100644 index 00000000000..ede9ae79b80 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <random> + +// template<class RealType = double> +// class fisher_f_distribution +// { +// public: +// // types +// typedef RealType result_type; + +#include <random> +#include <type_traits> + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::result_type result_type; + static_assert((std::is_same<result_type, double>::value), ""); + } + { + typedef std::fisher_f_distribution<float> D; + typedef D::result_type result_type; + static_assert((std::is_same<result_type, float>::value), ""); + } +} |