diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2010-05-17 16:21:56 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2010-05-17 16:21:56 +0000 |
| commit | c675d983f6aba7cbdbe241a88daf2f7ac944dc33 (patch) | |
| tree | 7cf7f62abe499c71d0e319ed2a73b6760bed649c /libcxx/test | |
| parent | 9154b5dffe4ffa014c65f4629a8429c4b166e3b3 (diff) | |
| download | bcm5719-llvm-c675d983f6aba7cbdbe241a88daf2f7ac944dc33.tar.gz bcm5719-llvm-c675d983f6aba7cbdbe241a88daf2f7ac944dc33.zip | |
[rand.dist.pois.extreme]
llvm-svn: 103942
Diffstat (limited to 'libcxx/test')
18 files changed, 914 insertions, 0 deletions
diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/assign.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/assign.pass.cpp new file mode 100644 index 00000000000..c8d41c6dded --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// extreme_value_distribution& operator=(const extreme_value_distribution&); + +#include <random> +#include <cassert> + +void +test1() +{ + typedef std::extreme_value_distribution<> D; + D d1(.5, 2); + D d2; + assert(d1 != d2); + d2 = d1; + assert(d1 == d2); +} + +int main() +{ + test1(); +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/copy.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/copy.pass.cpp new file mode 100644 index 00000000000..2ee785bf0bd --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// extreme_value_distribution(const extreme_value_distribution&); + +#include <random> +#include <cassert> + +void +test1() +{ + typedef std::extreme_value_distribution<> D; + D d1(.5, 1.75); + D d2 = d1; + assert(d1 == d2); +} + +int main() +{ + test1(); +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_double_double.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_double_double.pass.cpp new file mode 100644 index 00000000000..3d6e96b9a9b --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// explicit extreme_value_distribution(result_type a = 0, result_type b = 1); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + D d; + assert(d.a() == 0); + assert(d.b() == 1); + } + { + typedef std::extreme_value_distribution<> D; + D d(14.5); + assert(d.a() == 14.5); + assert(d.b() == 1); + } + { + typedef std::extreme_value_distribution<> D; + D d(14.5, 5.25); + assert(d.a() == 14.5); + assert(d.b() == 5.25); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/ctor_param.pass.cpp new file mode 100644 index 00000000000..6e1b8ae197e --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// explicit extreme_value_distribution(const param_type& parm); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + P p(0.25, 10); + D d(p); + assert(d.a() == 0.25); + assert(d.b() == 10); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eq.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eq.pass.cpp new file mode 100644 index 00000000000..e5941c2ac32 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// bool operator=(const extreme_value_distribution& x, +// const extreme_value_distribution& y); +// bool operator!(const extreme_value_distribution& x, +// const extreme_value_distribution& y); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + D d1(2.5, 4); + D d2(2.5, 4); + assert(d1 == d2); + } + { + typedef std::extreme_value_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.pois/rand.dist.pois.extreme/eval.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp new file mode 100644 index 00000000000..071ea6bc60f --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp @@ -0,0 +1,188 @@ +//===----------------------------------------------------------------------===// +// +// 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 extreme_value_distribution + +// template<class _URNG> result_type operator()(_URNG& g); + +#include <random> +#include <cassert> +#include <vector> +#include <numeric> + +template <class T> +inline +T +sqr(T x) +{ + return x * x; +} + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(0.5, 2); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + d.b() * 0.577215665; + double x_var = sqr(d.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(1, 2); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + d.b() * 0.577215665; + double x_var = sqr(d.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(1.5, 3); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + d.b() * 0.577215665; + double x_var = sqr(d.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(3, 4); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + d.b() * 0.577215665; + double x_var = sqr(d.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp new file mode 100644 index 00000000000..dd335a05900 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp @@ -0,0 +1,192 @@ +//===----------------------------------------------------------------------===// +// +// 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 extreme_value_distribution + +// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm); + +#include <random> +#include <cassert> +#include <vector> +#include <numeric> + +template <class T> +inline +T +sqr(T x) +{ + return x * x; +} + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(-0.5, 1); + P p(0.5, 2); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + p.b() * 0.577215665; + double x_var = sqr(p.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(-0.5, 1); + P p(1, 2); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + p.b() * 0.577215665; + double x_var = sqr(p.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(-0.5, 1); + P p(1.5, 3); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + p.b() * 0.577215665; + double x_var = sqr(p.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(-0.5, 1); + P p(3, 4); + const int N = 1000000; + std::vector<D::result_type> u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + u.push_back(v); + } + double mean = std::accumulate(u.begin(), u.end(), 0.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.a() + p.b() * 0.577215665; + double x_var = sqr(p.b()) * 1.644934067; + double x_skew = 1.139547; + double x_kurtosis = 12./5; + 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.01); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/get_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/get_param.pass.cpp new file mode 100644 index 00000000000..dd06b0b8563 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// param_type param() const; + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_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.pois/rand.dist.pois.extreme/io.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/io.pass.cpp new file mode 100644 index 00000000000..634b7eff131 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// template <class CharT, class Traits, class RealType> +// basic_ostream<CharT, Traits>& +// operator<<(basic_ostream<CharT, Traits>& os, +// const extreme_value_distribution<RealType>& x); + +// template <class CharT, class Traits, class RealType> +// basic_istream<CharT, Traits>& +// operator>>(basic_istream<CharT, Traits>& is, +// extreme_value_distribution<RealType>& x); + +#include <random> +#include <sstream> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + D d1(7.5, 5.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.pois/rand.dist.pois.extreme/max.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/max.pass.cpp new file mode 100644 index 00000000000..02ba0fd6e2d --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// result_type max() const; + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_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.pois/rand.dist.pois.extreme/min.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/min.pass.cpp new file mode 100644 index 00000000000..74ef71e7542 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution + +// result_type min() const; + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + D d(.5, .5); + assert(d.min() == -INFINITY); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_assign.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_assign.pass.cpp new file mode 100644 index 00000000000..b50cadb1844 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type param_type; + param_type p0(.75, 6); + param_type p; + p = p0; + assert(p.a() == .75); + assert(p.b() == 6); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_copy.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_copy.pass.cpp new file mode 100644 index 00000000000..bf716285835 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type param_type; + param_type p0(10, .125); + param_type p = p0; + assert(p.a() == 10); + assert(p.b() == .125); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_ctor.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_ctor.pass.cpp new file mode 100644 index 00000000000..766dcc27652 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type param_type; + param_type p; + assert(p.a() == 0); + assert(p.b() == 1); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type param_type; + param_type p(10); + assert(p.a() == 10); + assert(p.b() == 1); + } + { + typedef std::extreme_value_distribution<> D; + typedef D::param_type param_type; + param_type p(10, 5); + assert(p.a() == 10); + assert(p.b() == 5); + } +} diff --git a/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_eq.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_eq.pass.cpp new file mode 100644 index 00000000000..baa90bc1a4b --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution +// { +// class param_type; + +#include <random> +#include <limits> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_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::extreme_value_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.pois/rand.dist.pois.extreme/param_types.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/param_types.pass.cpp new file mode 100644 index 00000000000..a81661b4c86 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution +// { +// class param_type; + +#include <random> +#include <type_traits> + +int main() +{ + { + typedef std::extreme_value_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.pois/rand.dist.pois.extreme/set_param.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/set_param.pass.cpp new file mode 100644 index 00000000000..62b91d43856 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution; + +// void param(const param_type& parm); + +#include <random> +#include <cassert> + +int main() +{ + { + typedef std::extreme_value_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.pois/rand.dist.pois.extreme/types.pass.cpp b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/types.pass.cpp new file mode 100644 index 00000000000..175527a8160 --- /dev/null +++ b/libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/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 extreme_value_distribution +// { +// public: +// // types +// typedef RealType result_type; + +#include <random> +#include <type_traits> + +int main() +{ + { + typedef std::extreme_value_distribution<> D; + typedef D::result_type result_type; + static_assert((std::is_same<result_type, double>::value), ""); + } + { + typedef std::extreme_value_distribution<float> D; + typedef D::result_type result_type; + static_assert((std::is_same<result_type, float>::value), ""); + } +} |

