From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libstdc++-v3/testsuite/26_numerics/accumulate/1.cc | 54 ++++++ .../testsuite/26_numerics/accumulate/48750.cc | 70 ++++++++ .../requirements/explicit_instantiation/2.cc | 32 ++++ .../requirements/explicit_instantiation/pod.cc | 32 ++++ .../testsuite/26_numerics/adjacent_difference/1.cc | 45 +++++ .../requirements/explicit_instantiation/2.cc | 36 ++++ .../requirements/explicit_instantiation/pod.cc | 36 ++++ libstdc++-v3/testsuite/26_numerics/cmath/51083.cc | 62 +++++++ .../testsuite/26_numerics/complex/13450.cc | 82 ++++++++++ .../testsuite/26_numerics/complex/50880.cc | 53 ++++++ .../testsuite/26_numerics/complex/51083.cc | 54 ++++++ .../testsuite/26_numerics/complex/buggy_complex.cc | 35 ++++ .../complex/comparison_operators/constexpr.cc | 39 +++++ .../testsuite/26_numerics/complex/cons/48760.cc | 58 +++++++ .../26_numerics/complex/cons/constexpr.cc | 37 +++++ .../26_numerics/complex/cons/constexpr_primary.cc | 67 ++++++++ .../testsuite/26_numerics/complex/dr387_2.cc | 30 ++++ .../testsuite/26_numerics/complex/dr781_dr1137.cc | 70 ++++++++ .../testsuite/26_numerics/complex/dr844.cc | 51 ++++++ .../complex/inserters_extractors/char/1.cc | 138 ++++++++++++++++ .../complex/inserters_extractors/wchar_t/1.cc | 136 ++++++++++++++++ libstdc++-v3/testsuite/26_numerics/complex/pow.cc | 16 ++ .../complex/requirements/constexpr_functions.cc | 57 +++++++ .../26_numerics/complex/value_operations/1.cc | 65 ++++++++ .../complex/value_operations/constexpr.cc | 57 +++++++ .../26_numerics/complex/value_operations/dr387.cc | 51 ++++++ .../26_numerics/headers/ccomplex/std_c++0x_neg.cc | 26 +++ .../26_numerics/headers/cfenv/std_c++0x_neg.cc | 26 +++ .../26_numerics/headers/cfenv/types_std_c++0x.cc | 31 ++++ .../testsuite/26_numerics/headers/cmath/19322.cc | 35 ++++ .../testsuite/26_numerics/headers/cmath/25913.cc | 38 +++++ .../testsuite/26_numerics/headers/cmath/37582.cc | 35 ++++ .../headers/cmath/c99_classification_macros_c++.cc | 84 ++++++++++ .../cmath/c99_classification_macros_c++0x.cc | 92 +++++++++++ .../headers/cmath/c99_classification_macros_c.cc | 51 ++++++ .../testsuite/26_numerics/headers/cmath/c_math.cc | 70 ++++++++ .../26_numerics/headers/cmath/c_math_dynamic.cc | 49 ++++++ .../testsuite/26_numerics/headers/cmath/dr550.cc | 46 ++++++ .../26_numerics/headers/cmath/fabs_inline.cc | 36 ++++ .../26_numerics/headers/cmath/functions_std.cc | 46 ++++++ .../testsuite/26_numerics/headers/cmath/macros.cc | 27 +++ .../26_numerics/headers/cmath/overloads.cc | 47 ++++++ .../testsuite/26_numerics/headers/cmath/powi.cc | 63 +++++++ .../26_numerics/headers/cmath/types_std_c++0x.cc | 31 ++++ .../headers/cmath/types_std_c++0x_neg.cc | 73 +++++++++ .../26_numerics/headers/complex/synopsis.cc | 87 ++++++++++ .../testsuite/26_numerics/headers/cstdlib/13943.cc | 43 +++++ .../testsuite/26_numerics/headers/cstdlib/2190.cc | 36 ++++ .../26_numerics/headers/cstdlib/functions_std.cc | 30 ++++ .../26_numerics/headers/cstdlib/macros.cc | 27 +++ .../26_numerics/headers/cstdlib/types_std.cc | 26 +++ .../26_numerics/headers/cstdlib/types_std_c++0x.cc | 34 ++++ .../26_numerics/headers/ctgmath/std_c++0x_neg.cc | 26 +++ .../headers/numeric/numeric_parallel_mode.cc | 22 +++ .../headers/numeric/parallel_numeric.cc | 22 +++ .../headers/numeric/parallel_numeric_mixed1.cc | 48 ++++++ .../headers/numeric/parallel_numeric_mixed2.cc | 53 ++++++ .../26_numerics/headers/numeric/synopsis.cc | 64 ++++++++ .../26_numerics/headers/random/std_c++0x_neg.cc | 26 +++ .../26_numerics/headers/random/types_std_c++0x.cc | 27 +++ .../26_numerics/headers/valarray/synopsis.cc | 127 +++++++++++++++ .../26_numerics/headers/valarray/types_std.cc | 26 +++ .../testsuite/26_numerics/inner_product/1.cc | 56 +++++++ .../requirements/explicit_instantiation/2.cc | 34 ++++ .../requirements/explicit_instantiation/pod.cc | 34 ++++ libstdc++-v3/testsuite/26_numerics/iota/1.cc | 48 ++++++ .../iota/requirements/explicit_instantiation/2.cc | 33 ++++ .../requirements/explicit_instantiation/pod.cc | 33 ++++ .../testsuite/26_numerics/partial_sum/1.cc | 45 +++++ .../requirements/explicit_instantiation/2.cc | 35 ++++ .../requirements/explicit_instantiation/pod.cc | 35 ++++ .../random/bernoulli_distribution/cons/default.cc | 44 +++++ .../random/bernoulli_distribution/cons/parms.cc | 44 +++++ .../bernoulli_distribution/operators/equal.cc | 43 +++++ .../bernoulli_distribution/operators/inequal.cc | 43 +++++ .../bernoulli_distribution/operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/binomial_distribution/cons/default.cc | 45 +++++ .../random/binomial_distribution/cons/parms.cc | 45 +++++ .../binomial_distribution/operators/equal.cc | 43 +++++ .../binomial_distribution/operators/inequal.cc | 43 +++++ .../binomial_distribution/operators/serialize.cc | 47 ++++++ .../binomial_distribution/requirements/typedefs.cc | 35 ++++ .../random/cauchy_distribution/cons/default.cc | 46 ++++++ .../random/cauchy_distribution/cons/parms.cc | 46 ++++++ .../random/cauchy_distribution/operators/equal.cc | 43 +++++ .../cauchy_distribution/operators/inequal.cc | 43 +++++ .../cauchy_distribution/operators/serialize.cc | 46 ++++++ .../cauchy_distribution/requirements/typedefs.cc | 35 ++++ .../chi_squared_distribution/cons/default.cc | 45 +++++ .../random/chi_squared_distribution/cons/parms.cc | 45 +++++ .../chi_squared_distribution/operators/equal.cc | 43 +++++ .../chi_squared_distribution/operators/inequal.cc | 43 +++++ .../operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../26_numerics/random/default_random_engine.cc | 48 ++++++ .../random/discard_block_engine/cons/base_copy.cc | 40 +++++ .../random/discard_block_engine/cons/base_move.cc | 39 +++++ .../random/discard_block_engine/cons/copy.cc | 43 +++++ .../random/discard_block_engine/cons/default.cc | 39 +++++ .../random/discard_block_engine/cons/seed1.cc | 41 +++++ .../random/discard_block_engine/cons/seed2.cc | 41 +++++ .../random/discard_block_engine/cons/seed_seq.cc | 41 +++++ .../random/discard_block_engine/operators/equal.cc | 52 ++++++ .../discard_block_engine/operators/inequal.cc | 51 ++++++ .../discard_block_engine/operators/serialize.cc | 55 +++++++ .../requirements/constexpr_data.cc | 59 +++++++ .../requirements/constexpr_functions.cc | 59 +++++++ .../discard_block_engine/requirements/typedefs.cc | 39 +++++ .../random/discrete_distribution/cons/default.cc | 44 +++++ .../random/discrete_distribution/cons/initlist.cc | 43 +++++ .../discrete_distribution/cons/num_xbound_fun.cc | 70 ++++++++ .../random/discrete_distribution/cons/range.cc | 46 ++++++ .../operators/call-default.cc | 41 +++++ .../discrete_distribution/operators/equal.cc | 44 +++++ .../discrete_distribution/operators/inequal.cc | 44 +++++ .../discrete_distribution/operators/serialize.cc | 47 ++++++ .../discrete_distribution/requirements/typedefs.cc | 35 ++++ .../exponential_distribution/cons/default.cc | 45 +++++ .../random/exponential_distribution/cons/parms.cc | 45 +++++ .../exponential_distribution/operators/equal.cc | 43 +++++ .../exponential_distribution/operators/inequal.cc | 43 +++++ .../operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../extreme_value_distribution/cons/default.cc | 46 ++++++ .../extreme_value_distribution/cons/parms.cc | 46 ++++++ .../extreme_value_distribution/operators/equal.cc | 43 +++++ .../operators/inequal.cc | 43 +++++ .../operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/fisher_f_distribution/cons/default.cc | 46 ++++++ .../random/fisher_f_distribution/cons/parms.cc | 46 ++++++ .../fisher_f_distribution/operators/equal.cc | 43 +++++ .../fisher_f_distribution/operators/inequal.cc | 43 +++++ .../fisher_f_distribution/operators/serialize.cc | 46 ++++++ .../fisher_f_distribution/requirements/typedefs.cc | 35 ++++ .../random/gamma_distribution/cons/default.cc | 46 ++++++ .../random/gamma_distribution/cons/parms.cc | 46 ++++++ .../random/gamma_distribution/operators/equal.cc | 43 +++++ .../random/gamma_distribution/operators/inequal.cc | 43 +++++ .../gamma_distribution/operators/serialize.cc | 46 ++++++ .../gamma_distribution/requirements/typedefs.cc | 35 ++++ .../random/geometric_distribution/cons/default.cc | 45 +++++ .../random/geometric_distribution/cons/parms.cc | 45 +++++ .../geometric_distribution/operators/equal.cc | 43 +++++ .../geometric_distribution/operators/inequal.cc | 43 +++++ .../geometric_distribution/operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../independent_bits_engine/cons/base_copy.cc | 40 +++++ .../independent_bits_engine/cons/base_move.cc | 39 +++++ .../random/independent_bits_engine/cons/copy.cc | 44 +++++ .../random/independent_bits_engine/cons/default.cc | 40 +++++ .../random/independent_bits_engine/cons/seed1.cc | 42 +++++ .../random/independent_bits_engine/cons/seed2.cc | 42 +++++ .../independent_bits_engine/cons/seed_seq.cc | 42 +++++ .../independent_bits_engine/operators/equal.cc | 50 ++++++ .../independent_bits_engine/operators/inequal.cc | 49 ++++++ .../independent_bits_engine/operators/serialize.cc | 53 ++++++ .../requirements/constexpr_functions.cc | 62 +++++++ .../requirements/typedefs.cc | 42 +++++ .../testsuite/26_numerics/random/knuth_b.cc | 44 +++++ .../random/linear_congruential_engine/cons/copy.cc | 39 +++++ .../linear_congruential_engine/cons/default.cc | 44 +++++ .../linear_congruential_engine/cons/seed1.cc | 36 ++++ .../linear_congruential_engine/cons/seed2.cc | 36 ++++ .../linear_congruential_engine/cons/seed_seq.cc | 36 ++++ .../linear_congruential_engine/operators/equal.cc | 46 ++++++ .../operators/inequal.cc | 45 +++++ .../operators/serialize.cc | 51 ++++++ .../requirements/constants.cc | 41 +++++ .../requirements/constexpr_data.cc | 59 +++++++ .../requirements/constexpr_functions.cc | 55 +++++++ .../requirements/non_uint_neg.cc | 33 ++++ .../requirements/typedefs.cc | 35 ++++ .../random/lognormal_distribution/cons/default.cc | 46 ++++++ .../random/lognormal_distribution/cons/parms.cc | 46 ++++++ .../lognormal_distribution/operators/equal.cc | 43 +++++ .../lognormal_distribution/operators/inequal.cc | 43 +++++ .../lognormal_distribution/operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/mersenne_twister_engine/cons/copy.cc | 46 ++++++ .../random/mersenne_twister_engine/cons/default.cc | 48 ++++++ .../random/mersenne_twister_engine/cons/seed1.cc | 41 +++++ .../random/mersenne_twister_engine/cons/seed2.cc | 41 +++++ .../mersenne_twister_engine/cons/seed_seq.cc | 41 +++++ .../mersenne_twister_engine/operators/equal.cc | 53 ++++++ .../mersenne_twister_engine/operators/inequal.cc | 52 ++++++ .../mersenne_twister_engine/operators/serialize.cc | 56 +++++++ .../requirements/constants.cc | 51 ++++++ .../requirements/constexpr_data.cc | 79 +++++++++ .../requirements/constexpr_functions.cc | 55 +++++++ .../requirements/typedefs.cc | 40 +++++ .../testsuite/26_numerics/random/minstd_rand.cc | 44 +++++ .../testsuite/26_numerics/random/minstd_rand0.cc | 44 +++++ .../testsuite/26_numerics/random/mt19937.cc | 44 +++++ .../testsuite/26_numerics/random/mt19937_64.cc | 44 +++++ .../negative_binomial_distribution/cons/default.cc | 46 ++++++ .../negative_binomial_distribution/cons/parms.cc | 46 ++++++ .../operators/equal.cc | 44 +++++ .../operators/inequal.cc | 44 +++++ .../operators/serialize.cc | 47 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/normal_distribution/cons/default.cc | 46 ++++++ .../random/normal_distribution/cons/parms.cc | 46 ++++++ .../random/normal_distribution/operators/equal.cc | 43 +++++ .../normal_distribution/operators/inequal.cc | 43 +++++ .../normal_distribution/operators/serialize.cc | 46 ++++++ .../normal_distribution/requirements/typedefs.cc | 35 ++++ .../cons/default.cc | 48 ++++++ .../cons/initlist_fun.cc | 75 +++++++++ .../cons/num_xbound_fun.cc | 73 +++++++++ .../piecewise_constant_distribution/cons/range.cc | 51 ++++++ .../operators/call-default.cc | 41 +++++ .../operators/equal.cc | 47 ++++++ .../operators/inequal.cc | 47 ++++++ .../operators/serialize.cc | 50 ++++++ .../requirements/typedefs.cc | 35 ++++ .../piecewise_linear_distribution/cons/default.cc | 49 ++++++ .../cons/initlist_fun.cc | 75 +++++++++ .../cons/num_xbound_fun.cc | 73 +++++++++ .../piecewise_linear_distribution/cons/range.cc | 51 ++++++ .../operators/call-default.cc | 41 +++++ .../operators/equal.cc | 47 ++++++ .../operators/inequal.cc | 47 ++++++ .../operators/serialize.cc | 50 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/poisson_distribution/cons/default.cc | 45 +++++ .../random/poisson_distribution/cons/parms.cc | 45 +++++ .../random/poisson_distribution/operators/equal.cc | 43 +++++ .../poisson_distribution/operators/inequal.cc | 43 +++++ .../poisson_distribution/operators/serialize.cc | 46 ++++++ .../poisson_distribution/requirements/typedefs.cc | 35 ++++ .../random/random_device/cons/default.cc | 44 +++++ .../26_numerics/random/random_device/cons/token.cc | 48 ++++++ .../random/random_device/requirements/typedefs.cc | 34 ++++ .../testsuite/26_numerics/random/ranlux24.cc | 44 +++++ .../testsuite/26_numerics/random/ranlux24_base.cc | 44 +++++ .../testsuite/26_numerics/random/ranlux48.cc | 44 +++++ .../testsuite/26_numerics/random/ranlux48_base.cc | 44 +++++ .../26_numerics/random/seed_seq/cons/default.cc | 45 +++++ .../26_numerics/random/seed_seq/cons/initlist.cc | 45 +++++ .../26_numerics/random/seed_seq/cons/range.cc | 46 ++++++ .../random/seed_seq/requirements/typedefs.cc | 34 ++++ .../random/shuffle_order_engine/cons/base_copy.cc | 40 +++++ .../random/shuffle_order_engine/cons/base_move.cc | 39 +++++ .../random/shuffle_order_engine/cons/copy.cc | 43 +++++ .../random/shuffle_order_engine/cons/default.cc | 39 +++++ .../random/shuffle_order_engine/cons/seed1.cc | 41 +++++ .../random/shuffle_order_engine/cons/seed2.cc | 41 +++++ .../random/shuffle_order_engine/cons/seed_seq.cc | 41 +++++ .../random/shuffle_order_engine/operators/equal.cc | 52 ++++++ .../shuffle_order_engine/operators/inequal.cc | 51 ++++++ .../shuffle_order_engine/operators/serialize.cc | 55 +++++++ .../shuffle_order_engine/requirements/constants.cc | 39 +++++ .../requirements/constexpr_data.cc | 60 +++++++ .../requirements/constexpr_functions.cc | 62 +++++++ .../shuffle_order_engine/requirements/typedefs.cc | 41 +++++ .../random/student_t_distribution/cons/default.cc | 45 +++++ .../random/student_t_distribution/cons/parms.cc | 45 +++++ .../student_t_distribution/operators/equal.cc | 43 +++++ .../student_t_distribution/operators/inequal.cc | 43 +++++ .../student_t_distribution/operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/subtract_with_carry_engine/cons/copy.cc | 39 +++++ .../subtract_with_carry_engine/cons/default.cc | 41 +++++ .../subtract_with_carry_engine/cons/seed1.cc | 39 +++++ .../subtract_with_carry_engine/cons/seed2.cc | 39 +++++ .../subtract_with_carry_engine/cons/seed_seq.cc | 36 ++++ .../subtract_with_carry_engine/operators/equal.cc | 49 ++++++ .../operators/inequal.cc | 48 ++++++ .../operators/serialize.cc | 52 ++++++ .../requirements/constants.cc | 41 +++++ .../requirements/constexpr_data.cc | 59 +++++++ .../requirements/constexpr_functions.cc | 55 +++++++ .../requirements/typedefs.cc | 36 ++++ .../uniform_int_distribution/cons/default.cc | 46 ++++++ .../random/uniform_int_distribution/cons/parms.cc | 45 +++++ .../uniform_int_distribution/operators/equal.cc | 43 +++++ .../uniform_int_distribution/operators/inequal.cc | 43 +++++ .../operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../uniform_real_distribution/cons/default.cc | 45 +++++ .../random/uniform_real_distribution/cons/parms.cc | 45 +++++ .../uniform_real_distribution/operators/equal.cc | 43 +++++ .../uniform_real_distribution/operators/inequal.cc | 43 +++++ .../operators/serialize.cc | 46 ++++++ .../requirements/typedefs.cc | 35 ++++ .../random/weibull_distribution/cons/default.cc | 46 ++++++ .../random/weibull_distribution/cons/parms.cc | 46 ++++++ .../random/weibull_distribution/operators/equal.cc | 43 +++++ .../weibull_distribution/operators/inequal.cc | 43 +++++ .../weibull_distribution/operators/serialize.cc | 46 ++++++ .../weibull_distribution/requirements/typedefs.cc | 35 ++++ libstdc++-v3/testsuite/26_numerics/slice/1.cc | 63 +++++++ .../26_numerics/slice_array/array_assignment.cc | 40 +++++ .../requirements/explicit_instantiation.cc | 25 +++ .../slice_array/requirements/typedefs.cc | 30 ++++ .../testsuite/26_numerics/valarray/27867.cc | 44 +++++ .../testsuite/26_numerics/valarray/28277.cc | 43 +++++ .../testsuite/26_numerics/valarray/30416.cc | 181 +++++++++++++++++++++ .../testsuite/26_numerics/valarray/33084.cc | 39 +++++ .../testsuite/26_numerics/valarray/40691.cc | 39 +++++ .../testsuite/26_numerics/valarray/algo.cc | 31 ++++ .../26_numerics/valarray/binary_closure.cc | 37 +++++ .../26_numerics/valarray/const_bracket.cc | 39 +++++ .../testsuite/26_numerics/valarray/dr543.cc | 39 +++++ .../testsuite/26_numerics/valarray/dr630-1.cc | 60 +++++++ .../testsuite/26_numerics/valarray/dr630-2.cc | 67 ++++++++ .../testsuite/26_numerics/valarray/init-list.cc | 49 ++++++ .../testsuite/26_numerics/valarray/name_lookup.cc | 133 +++++++++++++++ .../testsuite/26_numerics/valarray/operators.cc | 68 ++++++++ .../testsuite/26_numerics/valarray/range_access.cc | 31 ++++ .../requirements/explicit_instantiation.cc | 25 +++ .../26_numerics/valarray/requirements/typedefs.cc | 30 ++++ .../26_numerics/valarray/subset_assignment.cc | 78 +++++++++ 315 files changed, 14595 insertions(+) create mode 100644 libstdc++-v3/testsuite/26_numerics/accumulate/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/accumulate/48750.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/adjacent_difference/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/cmath/51083.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/13450.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/50880.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/51083.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/buggy_complex.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/comparison_operators/constexpr.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/cons/48760.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/dr387_2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/dr781_dr1137.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/dr844.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/wchar_t/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/pow.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/value_operations/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/value_operations/dr387.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/complex/synopsis.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cstdlib/2190.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cstdlib/functions_std.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cstdlib/macros.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/numeric/synopsis.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/random/types_std_c++0x.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/valarray/synopsis.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/headers/valarray/types_std.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/inner_product/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/iota/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/pod.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/call-default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mt19937.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/call-default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/call-default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/slice/1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/slice_array/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/slice_array/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/27867.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/28277.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/30416.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/33084.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/40691.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/algo.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/dr630-1.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/dr630-2.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/operators.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc (limited to 'libstdc++-v3/testsuite/26_numerics') diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/1.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/1.cc new file mode 100644 index 000000000..a5cbe71b4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/1.cc @@ -0,0 +1,54 @@ +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.1 [lib.accumulate] + +#include +#include + +int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +const int NA = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int res = std::accumulate(A, A + NA, 11); + VERIFY( res == 66 ); +} + +bool B[] = {true, false, true, true, false, true, false, true, true, false}; +const int NB = sizeof(B) / sizeof(bool); + +void +test02() +{ + bool test __attribute__((unused)) = true; + + int res = std::accumulate(B, B + NB, 100); + VERIFY( res == 106 ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/48750.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/48750.cc new file mode 100644 index 000000000..450382c3c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/48750.cc @@ -0,0 +1,70 @@ +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +class NaturalParameters +{ +public: + + NaturalParameters() + : m_data(2) + { } + + std::vector::const_iterator + begin() const + { return m_data.begin(); } + + std::vector::const_iterator + end() const + { return m_data.begin(); } + + NaturalParameters& + operator+=(const NaturalParameters&) + { return *this; } + +private: + std::vector m_data; +}; + +inline +NaturalParameters +operator+(const NaturalParameters& a, const NaturalParameters& b) +{ + NaturalParameters tmp = a; + return tmp += b; +} + +// libstdc++/48750 +void test01() +{ + // Used to fail in parallel-mode with a segfault. + for (std::size_t i = 0; i < 1000; ++i) + { + std::vector ChildrenNP(1000); + NaturalParameters init; + NaturalParameters NP = std::accumulate(ChildrenNP.begin(), + ChildrenNP.end(), init); + } +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..01082025a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc @@ -0,0 +1,32 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + typedef __gnu_test::NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template value_type accumulate(iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc new file mode 100644 index 000000000..f9403c8b6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,32 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + typedef __gnu_test::pod_int value_type; + typedef value_type* iterator_type; + + template value_type accumulate(iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/adjacent_difference/1.cc b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/1.cc new file mode 100644 index 000000000..1ab0a98f5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/1.cc @@ -0,0 +1,45 @@ +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4 [lib.adjacent.difference] + +#include +#include +#include + +int A[] = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100}; +int B[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int D[N]; + + std::adjacent_difference(A, A + N, D); + VERIFY( std::equal(D, D + N, B) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..0a45aedba --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc @@ -0,0 +1,36 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template + output_iterator adjacent_difference(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc new file mode 100644 index 000000000..5fed31036 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,36 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template + output_iterator adjacent_difference(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/cmath/51083.cc b/libstdc++-v3/testsuite/26_numerics/cmath/51083.cc new file mode 100644 index 000000000..8ba9b10e5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/cmath/51083.cc @@ -0,0 +1,62 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace a +{ + template class Mat { }; + + template struct Mat2 : Mat { }; + + template + int fdim(Mat) { return 1; } + + template + int floor(Mat, U) { return 1; } + template + int floor(T, Mat) { return 1; } + + template + int fma(Mat, U, V) { return 1; } + template + int fma(T, Mat, V) { return 1; } + template + int fma(T, U, Mat) { return 1; } +} + +int main() +{ + int __attribute__((unused)) i; + + using namespace std; + + a::Mat2 c; + i = fdim(c); + i = floor(c, 0.); + i = floor(0., c); + i = floor(c, 1); + i = floor(1, c); + i = fma(c, 0., 1.); + i = fma(0., c, 1.); + i = fma(0., 1., c); + i = fma(c, 0., 1); + i = fma(0., c, 1); + i = fma(0., 1, c); +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/13450.cc b/libstdc++-v3/testsuite/26_numerics/complex/13450.cc new file mode 100644 index 000000000..c34648e20 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/13450.cc @@ -0,0 +1,82 @@ +// { dg-do run { xfail broken_cplxf_arg } } + +// Copyright (C) 2004, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.2.8 complex transcendentals + +#include +#include +#include + +template + void test01_do(T a, T b) + { + using namespace std; + bool test __attribute__((unused)) = true; + typedef complex cplx; + + T eps = numeric_limits::epsilon() * 100; + + cplx ref = pow(cplx(a, T()), cplx(b, T())); + cplx res1 = pow(a, cplx(b, T())); + cplx res2 = pow(cplx(a, T()), b); + + VERIFY( abs(ref - res1) < eps ); + VERIFY( abs(ref - res2) < eps ); + VERIFY( abs(res1 - res2) < eps ); + } + +// libstdc++/13450 +void test01() +{ + float f1 = -1.0f; + float f2 = 0.5f; + test01_do(f1, f2); + + f1 = -3.2f; + f2 = 1.4f; + test01_do(f1, f2); + + double d1 = -1.0; + double d2 = 0.5; + test01_do(d1, d2); + + d1 = -3.2; + d2 = 1.4; + test01_do(d1, d2); + +#if __LDBL_MANT_DIG__ != 106 + /* For IBM long double, epsilon is too small (since 1.0 plus any + double is representable) to be able to expect results within + epsilon * 100 (which may be much less than 1ulp for a particular + long double value). */ + long double ld1 = -1.0l; + long double ld2 = 0.5l; + test01_do(ld1, ld2); + + ld1 = -3.2l; + ld2 = 1.4l; + test01_do(ld1, ld2); +#endif +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/50880.cc b/libstdc++-v3/testsuite/26_numerics/complex/50880.cc new file mode 100644 index 000000000..2b70a99dd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/50880.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +template + void test01_do() + { + bool test __attribute__((unused)) = true; + + const std::complex ca(T(-2), T(2)); + const std::complex cb(T(-2), T(0)); + const std::complex cc(T(-2), T(-2)); + + std::complex cra = std::acosh(ca); + std::complex crb = std::acosh(cb); + std::complex crc = std::acosh(cc); + + VERIFY( cra.real() > T(0) ); + VERIFY( crb.real() > T(0) ); + VERIFY( crc.real() > T(0) ); + } + +// libstdc++/50880 +void test01() +{ + test01_do(); + test01_do(); + test01_do(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/51083.cc b/libstdc++-v3/testsuite/26_numerics/complex/51083.cc new file mode 100644 index 000000000..54e781ba1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/51083.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace a +{ + template class Mat { }; + + template struct Mat2 : Mat { }; + + template int arg(Mat) { return 1; } + template int conj(Mat) { return 1; } + template int imag(Mat) { return 1; } + template int norm(Mat) { return 1; } + template int proj(Mat) { return 1; } + template int real(Mat) { return 1; } + + template int pow(Mat, U) { return 1; } + template int pow(T, Mat) { return 1; } +} + +int main() +{ + int __attribute__((unused)) i; + + using namespace std; + + a::Mat2< std::complex > c; + i = arg(c); + i = conj(c); + i = imag(c); + i = norm(c); + i = proj(c); + i = real(c); + i = pow(std::complex(), c); + i = pow(c, std::complex()); +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/buggy_complex.cc b/libstdc++-v3/testsuite/26_numerics/complex/buggy_complex.cc new file mode 100644 index 000000000..a6cbc9991 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/buggy_complex.cc @@ -0,0 +1,35 @@ +// 2000-02-09 +// Gabriel Dos Reis + +// Copyright (C) 1999, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// Test buggy builtin GNU __complex__ support. This used to cause +// an ICE on some 64-bits plateforms. +// Origin: petter@matfys.lth.se + +#include + +int main() +{ + std::complex a(9), b(0, 8), c; + + c = a * b; + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/comparison_operators/constexpr.cc b/libstdc++-v3/testsuite/26_numerics/complex/comparison_operators/constexpr.cc new file mode 100644 index 000000000..85c3ab7b4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/comparison_operators/constexpr.cc @@ -0,0 +1,39 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +int main() +{ + __gnu_test::constexpr_comparison_eq_ne test; + test.operator()>(); + test.operator(), float>(); + test.operator()>(); + + test.operator()>(); + test.operator(), double>(); + test.operator()>(); + + test.operator()>(); + test.operator(), long double>(); + test.operator()>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/cons/48760.cc b/libstdc++-v3/testsuite/26_numerics/complex/cons/48760.cc new file mode 100644 index 000000000..0027a34e4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/cons/48760.cc @@ -0,0 +1,58 @@ +// { dg-require-c-std "" } + +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +template + void do_test01() + { + bool test __attribute__((unused)) = true; + + if (std::numeric_limits::has_quiet_NaN) + { + std::complex c1(T(0), std::numeric_limits::quiet_NaN()); + VERIFY( c1.real() == T(0) ); + VERIFY( std::isnan(c1.imag()) ); + + std::complex c2(std::numeric_limits::quiet_NaN(), T(0)); + VERIFY( std::isnan(c2.real()) ); + VERIFY( c2.imag() == T(0) ); + + std::complex c3(std::numeric_limits::quiet_NaN(), + std::numeric_limits::quiet_NaN()); + VERIFY( std::isnan(c3.real()) ); + VERIFY( std::isnan(c3.imag()) ); + } + } + +// libstdc++/48760 +void test01() +{ + do_test01(); + do_test01(); + do_test01(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc new file mode 100644 index 000000000..13d3c8168 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +int main() +{ + __gnu_test::constexpr_default_constructible test1; + test1.operator()>(); + test1.operator()>(); + test1.operator()>(); + + __gnu_test::constexpr_single_value_constructible test2; + test2.operator(), float>(); + test2.operator(), double>(); + test2.operator(), long double>(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc new file mode 100644 index 000000000..77e01bcff --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/cons/constexpr_primary.cc @@ -0,0 +1,67 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// User defined type, so that the primary std::complex template is used. +namespace numext +{ + struct ldld_base + { + long double one; + long double two; + }; + + struct ldld_lit : public ldld_base + { }; + + struct ldld_nonlit : public ldld_base + { + ~ldld_nonlit() { } + }; + + bool + operator<(const ldld_base __a, const ldld_base __b) + { return __a.one < __b.one && __a.two < __b.two; } + + bool + operator==(const ldld_base __a, const ldld_base __b) + { return __a.one == __b.one && __a.two == __b.two; } + + ldld_base + operator+=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one + __b.one, __a.two + __b.two}); } + + ldld_base + operator-=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one - __b.one, __a.two - __b.two}); } + + ldld_base + operator*=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one * __b.one, __a.two * __b.two}); } + + ldld_base + operator/=(const ldld_base __a, const ldld_base __b) + { return ldld_base({ __a.one / __b.one, __a.two / __b.two}); } + +} + +constexpr std::complex lit; // ok +// constexpr std::complex nonlit; // error diff --git a/libstdc++-v3/testsuite/26_numerics/complex/dr387_2.cc b/libstdc++-v3/testsuite/26_numerics/complex/dr387_2.cc new file mode 100644 index 000000000..06e0380cc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/dr387_2.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// DR 387. std::complex over-encapsulated. +// http://gcc.gnu.org/ml/gcc/2009-03/msg00264.html +typedef std::complex C; + +C f1(C& c) { return c+1.0; } +C f2(C& c) { return c-1.0; } +C f3(C& c) { return 1.0+c; } +C f4(C& c) { return 1.0-c; } diff --git a/libstdc++-v3/testsuite/26_numerics/complex/dr781_dr1137.cc b/libstdc++-v3/testsuite/26_numerics/complex/dr781_dr1137.cc new file mode 100644 index 000000000..145a4b044 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/dr781_dr1137.cc @@ -0,0 +1,70 @@ +// { dg-options "-std=gnu++0x" } +// 2008-05-22 Paolo Carlini +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +// DR 781. std::complex should add missing C99 functions. +// DR 1137. Return type of conj and proj. +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::check_ret_type; + + typedef std::complex cmplx_f_type; + typedef std::complex cmplx_d_type; + typedef std::complex cmplx_ld_type; + + const int i1 = 1; + const float f1 = 1.0f; + const double d1 = 1.0; + const long double ld1 = 1.0l; + + const cmplx_f_type c_f1(f1, f1); + const cmplx_d_type c_d1(d1, d1); + const cmplx_ld_type c_ld1(ld1, ld1); + + check_ret_type(std::proj(c_f1)); + check_ret_type(std::proj(c_d1)); + check_ret_type(std::proj(c_ld1)); + + check_ret_type(std::proj(f1)); + check_ret_type(std::proj(d1)); + check_ret_type(std::proj(i1)); + VERIFY( std::proj(i1) == std::proj(double(i1)) ); + check_ret_type(std::proj(ld1)); + + check_ret_type(std::conj(c_f1)); + check_ret_type(std::conj(c_d1)); + check_ret_type(std::conj(c_ld1)); + + check_ret_type(std::conj(f1)); + check_ret_type(std::conj(d1)); + check_ret_type(std::conj(i1)); + VERIFY( std::conj(i1) == std::conj(double(i1)) ); + check_ret_type(std::conj(ld1)); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/dr844.cc b/libstdc++-v3/testsuite/26_numerics/complex/dr844.cc new file mode 100644 index 000000000..909ec27a9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/dr844.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } +// 2008-06-12 Paolo Carlini +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +// DR 844. complex pow return type is ambiguous. +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::check_ret_type; + + typedef std::complex cmplx_f_type; + typedef std::complex cmplx_d_type; + typedef std::complex cmplx_ld_type; + + const int i1 = 1; + const float f1 = 1.0f; + const double d1 = 1.0; + const long double ld1 = 1.0l; + + check_ret_type(std::pow(cmplx_f_type(f1, f1), i1)); + VERIFY( std::pow(cmplx_f_type(f1, f1), i1) + == std::pow(cmplx_d_type(f1, f1), double(i1)) ); + check_ret_type(std::pow(cmplx_d_type(d1, d1), i1)); + check_ret_type(std::pow(cmplx_ld_type(ld1, ld1), i1)); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/1.cc b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/1.cc new file mode 100644 index 000000000..b7e65594c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/1.cc @@ -0,0 +1,138 @@ +// 2000-02-10 +// Petter Urkedal + +// Copyright (C) 2000, 2003, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include +#include +#include +#include +#include + +template +inline bool flteq(R x, R y) +{ + if (x == R(0)) return y == R(0); + else return std::fabs(x-y) < 1e-6*std::fabs(x); +} + +template +int +test_good(std::string str, R x, R y) +{ + bool test __attribute__((unused)) = true; + std::complex z; + char ch; + std::istringstream iss(str); + iss >> z >> ch; + VERIFY( iss.good() ); + VERIFY( flteq(z.real(), x) ); + VERIFY( flteq(z.imag(), y) ); + VERIFY( ch == '#' ); + return 0; +} + +template +int +test_fail(std::string str) +{ + bool test __attribute__((unused)) = true; + std::complex z; + std::istringstream iss(str); + iss >> z; + VERIFY( iss.fail() && !iss.bad() ); + return 0; +} + +template +int +testall() +{ + test_good("(-1.1,3.7)#", -1.1, 3.7); + test_good("( .7e6 , \n-3.1)#", .7e6, -3.1); + test_good("(\t0,-1)#", 0.0, -1.0); + test_good("(-3.14)#", -3.14, 0.0); + test_good("-.1#", -.1, 0.0); + test_good(" ( -2.7e3 )#", -2.7e3, 0.0); + test_good(" -.1#", -.1, 0.0); + test_fail("(a,1)"); + test_fail("(,1)"); + test_fail("(1,a)"); + test_fail("(1, )"); + test_fail("|1,1)"); + test_fail("(1|1)"); + test_fail("(1,1|"); + return 0; +} + +// libstdc++/2970 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + complex cf01(-1.1, -333.2); + stringstream ss; + ss << cf01; + string str = ss.str(); + VERIFY( str == "(-1.1,-333.2)" ); +} + +// libstdc++/2985 +struct gnu_char_traits : public std::char_traits +{ }; + +typedef std::basic_ostringstream gnu_sstream; +template class std::basic_string >; + +void test02() +{ + bool test __attribute__((unused)) = true; + + // Construct locale with specialized facets. + typedef gnu_sstream::__num_put_type numput_type; + typedef gnu_sstream::__num_get_type numget_type; + std::locale loc_c = std::locale::classic(); + std::locale loc_1(loc_c, new numput_type); + std::locale loc_2(loc_1, new numget_type); + VERIFY( std::has_facet(loc_2) ); + VERIFY( std::has_facet(loc_2) ); + + gnu_sstream sstr; + sstr.imbue(loc_2); + + + std::complex x(3, 4); + sstr << x; + VERIFY( sstr.str() == "(3,4)" ); +} + +int +main() +{ + testall(); + testall(); + testall(); + + test01(); + test02(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/wchar_t/1.cc b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/wchar_t/1.cc new file mode 100644 index 000000000..8b23aec19 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/wchar_t/1.cc @@ -0,0 +1,136 @@ +// Copyright (C) 2007, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include +#include +#include +#include +#include + +template +inline bool flteq(R x, R y) +{ + if (x == R(0)) return y == R(0); + else return std::fabs(x-y) < 1e-6*std::fabs(x); +} + +template +int +test_good(std::wstring str, R x, R y) +{ + bool test __attribute__((unused)) = true; + std::complex z; + wchar_t ch; + std::wistringstream iss(str); + iss >> z >> ch; + VERIFY( iss.good() ); + VERIFY( flteq(z.real(), x) ); + VERIFY( flteq(z.imag(), y) ); + VERIFY( ch == L'#' ); + return 0; +} + +template +int +test_fail(std::wstring str) +{ + bool test __attribute__((unused)) = true; + std::complex z; + std::wistringstream iss(str); + iss >> z; + VERIFY( iss.fail() && !iss.bad() ); + return 0; +} + +template +int +testall() +{ + test_good(L"(-1.1,3.7)#", -1.1, 3.7); + test_good(L"( .7e6 , \n-3.1)#", .7e6, -3.1); + test_good(L"(\t0,-1)#", 0.0, -1.0); + test_good(L"(-3.14)#", -3.14, 0.0); + test_good(L"-.1#", -.1, 0.0); + test_good(L" ( -2.7e3 )#", -2.7e3, 0.0); + test_good(L" -.1#", -.1, 0.0); + test_fail(L"(a,1)"); + test_fail(L"(,1)"); + test_fail(L"(1,a)"); + test_fail(L"(1, )"); + test_fail(L"|1,1)"); + test_fail(L"(1|1)"); + test_fail(L"(1,1|"); + return 0; +} + +// libstdc++/2970 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + complex cf01(-1.1, -333.2); + wstringstream ss; + ss << cf01; + wstring str = ss.str(); + VERIFY( str == L"(-1.1,-333.2)" ); +} + +// libstdc++/2985 +struct gnu_char_traits : public std::char_traits +{ }; + +typedef std::basic_ostringstream gnu_sstream; +template class std::basic_string >; + +void test02() +{ + bool test __attribute__((unused)) = true; + + // Construct locale with specialized facets. + typedef gnu_sstream::__num_put_type numput_type; + typedef gnu_sstream::__num_get_type numget_type; + std::locale loc_c = std::locale::classic(); + std::locale loc_1(loc_c, new numput_type); + std::locale loc_2(loc_1, new numget_type); + VERIFY( std::has_facet(loc_2) ); + VERIFY( std::has_facet(loc_2) ); + + gnu_sstream sstr; + sstr.imbue(loc_2); + + + std::complex x(3, 4); + sstr << x; + VERIFY( sstr.str() == L"(3,4)" ); +} + +int +main() +{ + testall(); + testall(); + testall(); + + test01(); + test02(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/pow.cc b/libstdc++-v3/testsuite/26_numerics/complex/pow.cc new file mode 100644 index 000000000..a43e3c674 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/pow.cc @@ -0,0 +1,16 @@ +// { dg-do run { xfail broken_cplxf_arg } } +// PR libstdc++/10689 +// Origin: Daniel.Levine@jhuaph.edu +// { dg-add-options ieee } + +#include +#include + +int main() +{ + std::complex z; + + VERIFY( pow(z, 1.0/3.0) == 0.0 ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc new file mode 100644 index 000000000..eae5ee7e8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/requirements/constexpr_functions.cc @@ -0,0 +1,57 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + typedef typename _Ttesttype::_ComplexT _ComplexT; + const _ComplexT cc = { 1.1 }; + constexpr _Ttesttype a(cc); + constexpr auto v1 __attribute__((unused)) = a.real(); + constexpr auto v2 __attribute__((unused)) = a.imag(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + test.operator()>(); + test.operator()>(); + test.operator()>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/value_operations/1.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/1.cc new file mode 100644 index 000000000..dc05a2b19 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/1.cc @@ -0,0 +1,65 @@ +// { dg-do run { xfail broken_cplxf_arg } } +// { dg-options "-O0" } +// 2000-11-20 +// Benjamin Kosnik bkoz@redhat.com + +// Copyright (C) 2000, 2003, 2004, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + typedef complex complex_type; + const double cd1 = -11.451; + const double cd2 = -442.1533; + + complex_type a(cd1, cd2); + double d; + d = a.real(); + VERIFY( d == cd1 ); + + d = a.imag(); + VERIFY( d == cd2 ); + + complex_type c(cd1, cd2); + double d6 = abs(c); + VERIFY( d6 >= 0 ); + + double d7 = arg(c); + double d8 = atan2(c.imag(), c.real()); + VERIFY( d7 == d8 ); + + double d9 = norm(c); + double d10 = d6 * d6; + VERIFY( d9 - d10 == 0 ); + + complex_type e __attribute__((unused)) = conj(c); + + complex_type f = polar(c.imag(), 0.0); + VERIFY( f.real() != 0 ); +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.cc new file mode 100644 index 000000000..29728a2b3 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/constexpr.cc @@ -0,0 +1,57 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + typedef typename _Ttesttype::_ComplexT _ComplexT; + const _ComplexT cc = { 1.1 }; + constexpr _Ttesttype a(cc); + constexpr auto v1 __attribute__((unused)) = real(a); + constexpr auto v2 __attribute__((unused)) = imag(a); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_functions test; + test.operator()>(); + test.operator()>(); + test.operator()>(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/complex/value_operations/dr387.cc b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/dr387.cc new file mode 100644 index 000000000..084a52c31 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/value_operations/dr387.cc @@ -0,0 +1,51 @@ +// 2008-05-22 Paolo Carlini +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// DR 387. std::complex over-encapsulated. +template + void + do_test() + { + bool test __attribute__((unused)) = true; + + const T r = 1.0; + const T i = -1.0; + const T v = 0.0; + + std::complex z1(r, i); + z1.real(v); + VERIFY( z1.real() == v ); + VERIFY( z1.imag() == i ); + + std::complex z2(r, i); + z2.imag(v); + VERIFY( z2.real() == r ); + VERIFY( z2.imag() == v ); + } + +int main() +{ + do_test(); + do_test(); + do_test(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc new file mode 100644 index 000000000..29e8dac5f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=gnu++98" } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// { dg-error "upcoming ISO" "" { target *-*-* } 32 } + + + diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc new file mode 100644 index 000000000..3a1910692 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=gnu++98" } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// { dg-error "upcoming ISO" "" { target *-*-* } 32 } + + + diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc new file mode 100644 index 000000000..dbe066ac0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cfenv/types_std_c++0x.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ +#if _GLIBCXX_USE_C99_FENV_TR1 + + typedef std::fenv_t my_fenv_t; + typedef std::fexcept_t my_fexcept_t; + +#endif +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc new file mode 100644 index 000000000..25494c357 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc @@ -0,0 +1,35 @@ +// { dg-require-c-std "" } + +// Copyright (C) 2005, 2009, 2010, 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// libstdc++/19322 +void test01() +{ + bool test __attribute__((unused)) = true; + + VERIFY( !std::isnan(3.0) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc new file mode 100644 index 000000000..025db2c2c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc @@ -0,0 +1,38 @@ +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// { dg-do compile } + +#include +#include + +struct employee +: private std::string { }; + +struct manager +: public employee { }; + +bool isnormal(const employee&) +{ return false; } + +// libstdc++/25913 +void test01() +{ + manager m; + isnormal(m); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc new file mode 100644 index 000000000..0cec658d8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// { dg-do compile } + +#include + +struct foo +{ + foo (double); +}; + +bool operator &&(int, const foo &); + +// libstdc++/37582 +double +test01(double x) +{ + return std::pow (x, 2.0); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc new file mode 100644 index 000000000..3f4b8ba26 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc @@ -0,0 +1,84 @@ +// 2001-04-06 gdr + +// Copyright (C) 2001, 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// { dg-do compile { xfail uclibc } } +// { dg-excess-errors "" { target uclibc } } + +#include + +void fpclassify() { } + +void isfinite() { } + +void isinf() { } + +void isnan() { } + +void isnormal() { } + +void signbit() { } + +void isgreater() { } + +void isgreaterequal() { } + +void isless() { } + +void islessequal() { } + +void islessgreater() { } + +void isunordered() { } + +#if _GLIBCXX_USE_C99_MATH +template + void test_c99_classify() + { + bool test __attribute__((unused)) = true; + + typedef _Tp fp_type; + fp_type f1 = 1.0; + fp_type f2 = 3.0; + int res = 0; + + res = std::fpclassify(f1); + res = std::isfinite(f2); + res = std::isinf(f1); + res = std::isnan(f2); + res = std::isnormal(f1); + res = std::signbit(f2); + res = std::isgreater(f1, f2); + res = std::isgreaterequal(f1, f2); + res = std::isless(f1, f2); + res = std::islessequal(f1,f2); + res = std::islessgreater(f1, f2); + res = std::isunordered(f1, f2); + res = res; // Suppress unused warning. + } +#endif + +int main() +{ +#if _GLIBCXX_USE_C99_MATH + test_c99_classify(); + test_c99_classify(); +#endif + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc new file mode 100644 index 000000000..413fe6925 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc @@ -0,0 +1,92 @@ +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++0x" } +// { dg-do compile { xfail uclibc } } +// { dg-excess-errors "" { target uclibc } } + +#include + +void fpclassify() { } + +void isfinite() { } + +void isinf() { } + +void isnan() { } + +void isnormal() { } + +void signbit() { } + +void isgreater() { } + +void isgreaterequal() { } + +void isless() { } + +void islessequal() { } + +void islessgreater() { } + +void isunordered() { } + +#if _GLIBCXX_USE_C99_MATH +template + void test_c99_classify() + { + bool test __attribute__((unused)) = true; + + typedef _Tp fp_type_one; + typedef _Up fp_type_two; + fp_type_one f1 = 1.0; + fp_type_two f2 = 3.0; + int resi; + bool res; + + resi = std::fpclassify(f1); + res = std::isfinite(f2); + res = std::isinf(f1); + res = std::isnan(f2); + res = std::isnormal(f1); + res = std::signbit(f2); + res = std::isgreater(f1, f2); + res = std::isgreaterequal(f1, f2); + res = std::isless(f1, f2); + res = std::islessequal(f1,f2); + res = std::islessgreater(f1, f2); + res = std::isunordered(f1, f2); + resi = resi; // Suppress unused warning. + res = res; + } +#endif + +int main() +{ +#if _GLIBCXX_USE_C99_MATH + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); + test_c99_classify(); +#endif + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc new file mode 100644 index 000000000..716dda51b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc @@ -0,0 +1,51 @@ +// 2001-04-06 gdr + +// Copyright (C) 2001, 2005, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile } +// { dg-add-options no_pch } + +// { dg-xfail-if "" { { *-*-linux* *-*-darwin* *-*-solaris2.1[0-9]* hppa*-*-hpux* } || { uclibc || newlib } } { "*" } { "" } } +// { dg-excess-errors "" { target { { *-*-linux* *-*-darwin* *-*-solaris2.1[0-9]* hppa*-*-hpux* } || { uclibc || newlib } } } } + +#include + +void fpclassify() { } + +void isfinite() { } + +void isinf() { } + +void isnan() { } + +void isnormal() { } + +void signbit() { } + +void isgreater() { } + +void isgreaterequal() { } + +void isless() { } + +void islessequal() { } + +void islessgreater() { } + +void isunordered() { } + diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc new file mode 100644 index 000000000..b8cf6e5e1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc @@ -0,0 +1,70 @@ +// 1999-06-05 +// Gabriel Dos Reis + +// Copyright (C) 1999, 2000, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// test compilation. +int +test01() +{ + float a = 1.f; + float b; + std::modf(a, &b); + return 0; +} + +// need more extravagant checks than this, of course, but this used to core... +int +test02() +{ + std::sin(static_cast(0)); + return 0; +} + +// as did this. +int +test03() +{ + double powtest __attribute__((unused)) = std::pow(2., 0); + return 0; +} + +// this used to abort. +int +test04() +{ + bool test __attribute__((unused)) = true; + float x[2] = {1, 2}; + float y = 3.4; + std::modf(y, &x[0]); + VERIFY(x[1] == 2); + return 0; +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc new file mode 100644 index 000000000..de4dbe39c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc @@ -0,0 +1,49 @@ +// Inspired by libstdc++/7680 & 26_numerics/c_math.cc, 2003-04-12 ljr + +// Copyright (C) 2003, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// { dg-do link } +// { dg-options "-D_XOPEN_SOURCE" { target *-*-freebsd* } } + +#include + +int +test01() +{ + float a = 1.f; + float b; + std::modf(a, &b); + return 0; +} + +int +test02 () +{ + float a = 0.0f; + float b __attribute__((unused)) = std::acos(a); + return 0; +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc new file mode 100644 index 000000000..c8f7c5cc5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } +// 2008-05-26 Paolo Carlini +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +// DR 550. What should the return type of pow(float,int) be? +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::check_ret_type; + + const int i1 = 1; + const float f1 = 1.0f; + const double d1 = 1.0; + const long double ld1 = 1.0l; + + check_ret_type(std::pow(f1, i1)); + VERIFY( std::pow(f1, i1) == std::pow(double(f1), double(i1)) ); + check_ret_type(std::pow(d1, i1)); + check_ret_type(std::pow(ld1, i1)); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc new file mode 100644 index 000000000..17057773e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc @@ -0,0 +1,36 @@ +// Copyright (C) 1999, 2002, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// Test to see whether the host provides its own (inline) view of fabs. +// Origin: Kurt Garloff , 2001-05-24 +// dg-do link + +#include +#include + +typedef double (*realfn) (double); + +using std::fabs; + +int main () +{ + double a = fabs (-2.4); + realfn myfn = fabs; + double b = myfn (-2.5); + std::printf ("%f, %f, %p\n", a, b, myfn); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc new file mode 100644 index 000000000..5226ee4eb --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ + using std::acos; + using std::asin; + using std::atan; + using std::atan2; + using std::ceil; + using std::cos; + using std::cosh; + using std::exp; + using std::fabs; + using std::floor; + using std::fmod; + using std::frexp; + using std::ldexp; + using std::log; + using std::log10; + using std::modf; + using std::pow; + using std::sin; + using std::sinh; + using std::sqrt; + using std::tan; + using std::tanh; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc new file mode 100644 index 000000000..754f94402 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc @@ -0,0 +1,27 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ +#ifndef HUGE_VAL + #error "HUGE_VAL_must_be_a_macro" +#endif +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc new file mode 100644 index 000000000..5819e1a18 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc @@ -0,0 +1,47 @@ +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// PR 3181 +// Origin: pete@toyon.com + +#include + +int main() +{ + int i = -1; + int j = 9; + double ans; + ans = std::abs(i); + ans = std::acos(i); + ans = std::asin(i); + ans = std::atan(i); + ans = std::atan2(i, j); + ans = std::cos(i); + ans = std::cosh(i); + ans = std::exp(i); + ans = std::fabs(i); + ans = std::floor(i); + ans = std::log(i); + ans = std::log10(i); + ans = std::sqrt(i); + ans = std::sin(i); + ans = std::sinh(j); + ans = std::tan(i); + ans = std::tanh(i); + ans = ans; // Suppress unused warnings. +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc new file mode 100644 index 000000000..2af912357 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc @@ -0,0 +1,63 @@ +// 2005-02-13 Paolo Carlini + +// Copyright (C) 2005, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5 C Library + +#include +#include + +template + void test01_do() + { + using namespace std; + bool test __attribute__((unused)) = true; + + VERIFY( pow(T(1.0), 0) == T(1.0) ); + VERIFY( pow(T(2.0), 0) == T(1.0) ); + VERIFY( pow(T(-1.0), 0) == T(1.0) ); + VERIFY( pow(T(-4.0), 0) == T(1.0) ); + + VERIFY( pow(T(1.0), 1) == T(1.0) ); + VERIFY( pow(T(2.0), 1) == T(2.0) ); + VERIFY( pow(T(-1.0), 1) == T(-1.0) ); + VERIFY( pow(T(-4.0), 1) == T(-4.0) ); + + VERIFY( pow(T(1.0), -1) == T(1.0) / T(1.0) ); + VERIFY( pow(T(2.0), -1) == T(1.0) / T(2.0) ); + VERIFY( pow(T(-1.0), -1) == T(1.0) / T(-1.0) ); + VERIFY( pow(T(-4.0), -1) == T(1.0) / T(-4.0) ); + + VERIFY( pow(T(1.0), 2) == T(1.0) * T(1.0) ); + VERIFY( pow(T(2.0), 2) == T(2.0) * T(2.0) ); + VERIFY( pow(T(-1.0), 2) == T(-1.0) * T(-1.0) ); + VERIFY( pow(T(-4.0), 2) == T(-4.0) * T(-4.0) ); + } + +void test01() +{ + test01_do(); + test01_do(); + test01_do(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc new file mode 100644 index 000000000..7e4abe90e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ +#if _GLIBCXX_USE_C99_MATH_TR1 + + typedef std::double_t my_double_t; + typedef std::float_t my_float_t; + +#endif +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc new file mode 100644 index 000000000..27fd15cde --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ + // C++0x changes from TR1. + using std::assoc_laguerre; + using std::assoc_legendre; + using std::beta; + using std::comp_ellint_1; + using std::comp_ellint_2; + using std::comp_ellint_3; + using std::conf_hyperg; + using std::cyl_bessel_i; + using std::cyl_bessel_j; + using std::cyl_bessel_k; + using std::cyl_neumann; + using std::ellint_1; + using std::ellint_2; + using std::ellint_3; + using std::expint; + using std::hermite; + using std::hyperg; + using std::laguerre; + using std::legendre; + using std::riemann_zeta; + using std::sph_bessel; + using std::sph_legendre; + using std::sph_neumann; +} + +// { dg-error "has not been declared" "" { target *-*-* } 26 } +// { dg-error "has not been declared" "" { target *-*-* } 27 } +// { dg-error "has not been declared" "" { target *-*-* } 28 } +// { dg-error "has not been declared" "" { target *-*-* } 29 } +// { dg-error "has not been declared" "" { target *-*-* } 30 } +// { dg-error "has not been declared" "" { target *-*-* } 31 } +// { dg-error "has not been declared" "" { target *-*-* } 32 } +// { dg-error "has not been declared" "" { target *-*-* } 33 } +// { dg-error "has not been declared" "" { target *-*-* } 34 } +// { dg-error "has not been declared" "" { target *-*-* } 35 } +// { dg-error "has not been declared" "" { target *-*-* } 36 } +// { dg-error "has not been declared" "" { target *-*-* } 37 } +// { dg-error "has not been declared" "" { target *-*-* } 38 } +// { dg-error "has not been declared" "" { target *-*-* } 39 } +// { dg-error "has not been declared" "" { target *-*-* } 40 } +// { dg-error "has not been declared" "" { target *-*-* } 41 } +// { dg-error "has not been declared" "" { target *-*-* } 42 } +// { dg-error "has not been declared" "" { target *-*-* } 43 } +// { dg-error "has not been declared" "" { target *-*-* } 44 } +// { dg-error "has not been declared" "" { target *-*-* } 45 } +// { dg-error "has not been declared" "" { target *-*-* } 46 } +// { dg-error "has not been declared" "" { target *-*-* } 47 } +// { dg-error "has not been declared" "" { target *-*-* } 48 } diff --git a/libstdc++-v3/testsuite/26_numerics/headers/complex/synopsis.cc b/libstdc++-v3/testsuite/26_numerics/headers/complex/synopsis.cc new file mode 100644 index 000000000..4d885930b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/complex/synopsis.cc @@ -0,0 +1,87 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace std { + template class complex; + template<> class complex; + template<> class complex; + template<> class complex; + + // 26.2.6 operators: + template + complex operator+(const complex&, const complex&); + template complex operator+(const complex&, const T&); + template complex operator+(const T&, const complex&); + template complex operator- + (const complex&, const complex&); + template complex operator-(const complex&, const T&); + template complex operator-(const T&, const complex&); + template complex operator* + (const complex&, const complex&); + template complex operator*(const complex&, const T&); + template complex operator*(const T&, const complex&); + template complex operator/ + (const complex&, const complex&); + template complex operator/(const complex&, const T&); + template complex operator/(const T&, const complex&); + template complex operator+(const complex&); + template complex operator-(const complex&); + template bool operator== + (const complex&, const complex&); + template bool operator==(const complex&, const T&); + template bool operator==(const T&, const complex&); + + + template bool operator!=(const complex&, const complex&); + template bool operator!=(const complex&, const T&); + template bool operator!=(const T&, const complex&); + template + basic_istream& + operator>>(basic_istream&, complex&); + template + basic_ostream& + operator<<(basic_ostream&, const complex&); + + // 26.2.7 values: + template T real(const complex&); + template T imag(const complex&); + template T abs(const complex&); + template T arg(const complex&); + template T norm(const complex&); + template complex conj(const complex&); + template complex polar(const T& rho, const T& theta = 0); + + // 26.2.8 transcendentals: + template complex cos(const complex&); + template complex cosh(const complex&); + template complex exp(const complex&); + template complex log(const complex&); + template complex log10(const complex&); + template complex pow(const complex&, int); + template complex pow(const complex&, const T&); + template complex pow(const complex&, const complex&); + template complex pow(const T&, const complex&); + template complex sin (const complex&); + template complex sinh(const complex&); + template complex sqrt(const complex&); + template complex tan(const complex&); + template complex tanh(const complex&); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc new file mode 100644 index 000000000..ff40cd67c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/13943.cc @@ -0,0 +1,43 @@ +// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +#if _GLIBCXX_USE_C99 +// libstdc++/13943 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + VERIFY( llabs(-3) == 3 ); + + lldiv_t q = lldiv(6, 4); + VERIFY( q.quot == 1 ); + VERIFY( q.rem == 2 ); +} +#endif + +int main() +{ +#if _GLIBCXX_USE_C99 + test01(); +#endif + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/2190.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/2190.cc new file mode 100644 index 000000000..b3a5075ed --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/2190.cc @@ -0,0 +1,36 @@ +// 2000-01-01 bkoz + +// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 17.4.1.2 Headers, cstdlib + +#include + +// libstdc++/2190 +void test01() +{ + long a __attribute__((unused)) = std::abs(1L); + std::div(2L, 1L); + std::ldiv_t b __attribute__((unused)); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/functions_std.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/functions_std.cc new file mode 100644 index 000000000..b37b588aa --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/functions_std.cc @@ -0,0 +1,30 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ + using std::abs; + using std::div; + using std::labs; + using std::ldiv; + using std::srand; + using std::rand; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/macros.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/macros.cc new file mode 100644 index 000000000..5aa0889df --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/macros.cc @@ -0,0 +1,27 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ +#ifndef RAND_MAX + #error "RAND_MAX_must_be_a_macro" +#endif +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std.cc new file mode 100644 index 000000000..503caf1dd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std.cc @@ -0,0 +1,26 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ + std::div_t d; + std::ldiv_t ld; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc new file mode 100644 index 000000000..0eb8b651a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cstdlib/types_std_c++0x.cc @@ -0,0 +1,34 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +#if _GLIBCXX_HOSTED + +void test01() +{ +#if _GLIBCXX_USE_C99 + + typedef std::lldiv_t my_lldiv_t; + +#endif +} + +#endif diff --git a/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc new file mode 100644 index 000000000..23b266e85 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=gnu++98" } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// { dg-error "upcoming ISO" "" { target *-*-* } 32 } + + + diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc new file mode 100644 index 000000000..3db5fc22a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc @@ -0,0 +1,22 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-D_GLIBCXX_PARALLEL -fopenmp" { target *-*-* } } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc new file mode 100644 index 000000000..452f8fe35 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc @@ -0,0 +1,22 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc new file mode 100644 index 000000000..a1ce8f052 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc @@ -0,0 +1,48 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include +#include + +void test() +{ + typedef unsigned short value_type; + typedef std::vector vector_type; + + const value_type c(0); + + vector_type v(10); + + std::accumulate(v.begin(), v.end(), value_type(1)); + std::accumulate(v.begin(), v.end(), value_type(1), std::plus()); + __gnu_parallel::accumulate(v.begin(), v.end(), value_type(1)); + __gnu_parallel::accumulate(v.begin(), v.end(), value_type(1), + std::plus()); + + std::inner_product(v.begin(), v.end(), v.begin(), value_type(1)); + std::inner_product(v.begin(), v.end(), v.begin(), value_type(1), + std::multiplies(), std::plus()); + __gnu_parallel::inner_product(v.begin(), v.end(), v.begin(), value_type(1)); + __gnu_parallel::inner_product(v.begin(), v.end(), v.begin(), value_type(1), + std::multiplies(), std::plus()); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc new file mode 100644 index 000000000..a38d92561 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc @@ -0,0 +1,53 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// Make sure to test without _GLIBCXX_PARALLEL +#ifdef _GLIBCXX_PARALLEL +# undef _GLIBCXX_PARALLEL +#endif + +#include +#include +#include +#include + +void test() +{ + typedef unsigned short value_type; + typedef std::vector vector_type; + + const value_type c(0); + + vector_type v(10); + + std::accumulate(v.begin(), v.end(), value_type(1)); + std::accumulate(v.begin(), v.end(), value_type(1), std::plus()); + __gnu_parallel::accumulate(v.begin(), v.end(), value_type(1)); + __gnu_parallel::accumulate(v.begin(), v.end(), value_type(1), + std::plus()); + + std::inner_product(v.begin(), v.end(), v.begin(), value_type(1)); + std::inner_product(v.begin(), v.end(), v.begin(), value_type(1), + std::multiplies(), std::plus()); + __gnu_parallel::inner_product(v.begin(), v.end(), v.begin(), value_type(1)); + __gnu_parallel::inner_product(v.begin(), v.end(), v.begin(), value_type(1), + std::multiplies(), std::plus()); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/synopsis.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/synopsis.cc new file mode 100644 index 000000000..21a21c9ff --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/synopsis.cc @@ -0,0 +1,64 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace std { + template + T accumulate(InputIterator first, InputIterator last, T init); + + template + T accumulate(InputIterator first, InputIterator last, T init, + BinaryOperation binary_op); + + template + T inner_product(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, T init); + + template + T inner_product(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, T init, + BinaryOperation1 binary_op1, + BinaryOperation2 binary_op2); + + template + OutputIterator partial_sum(InputIterator first, + InputIterator last, + OutputIterator result); + + template + OutputIterator partial_sum(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryOperation binary_op); + + template + OutputIterator adjacent_difference(InputIterator first, + InputIterator last, + OutputIterator result); + + template + OutputIterator adjacent_difference(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryOperation binary_op); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc new file mode 100644 index 000000000..1f83cdac6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=gnu++98" } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// { dg-error "upcoming ISO" "" { target *-*-* } 32 } + + + diff --git a/libstdc++-v3/testsuite/26_numerics/headers/random/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/random/types_std_c++0x.cc new file mode 100644 index 000000000..9f8ae967e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/random/types_std_c++0x.cc @@ -0,0 +1,27 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ + using std::random_device; + using std::bernoulli_distribution; +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/valarray/synopsis.cc b/libstdc++-v3/testsuite/26_numerics/headers/valarray/synopsis.cc new file mode 100644 index 000000000..2f7b08468 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/valarray/synopsis.cc @@ -0,0 +1,127 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace std { + template class valarray; + + class slice; + template class slice_array; + + class gslice; + template class gslice_array; + template class mask_array; + template class indirect_array; + template valarray operator* + (const valarray&, const valarray&); + template valarray operator* (const valarray&, const T&); + template valarray operator* (const T&, const valarray&); + +template valarray operator/ + (const valarray&, const valarray&); +template valarray operator/ (const valarray&, const T&); +template valarray operator/ (const T&, const valarray&); +template valarray operator% + (const valarray&, const valarray&); +template valarray operator% (const valarray&, const T&); +template valarray operator% (const T&, const valarray&); +template valarray operator+ + (const valarray&, const valarray&); +template valarray operator+ (const valarray&, const T&); +template valarray operator+ (const T&, const valarray&); +template valarray operator- + (const valarray&, const valarray&); +template valarray operator- (const valarray&, const T&); +template valarray operator- (const T&, const valarray&); +template valarray operator^ + (const valarray&, const valarray&); +template valarray operator^ (const valarray&, const T&); +template valarray operator^ (const T&, const valarray&); +template valarray operator& + (const valarray&, const valarray&); +template valarray operator& (const valarray&, const T&); +template valarray operator& (const T&, const valarray&); +template valarray operator| + (const valarray&, const valarray&); +template valarray operator| (const valarray&, const T&); +template valarray operator| (const T&, const valarray&); +template valarray operator<< + (const valarray&, const valarray&); +template valarray operator<<(const valarray&, const T&); +template valarray operator<<(const T&, const valarray&); +template valarray operator>> + (const valarray&, const valarray&); +template valarray operator>>(const valarray&, const T&); +template valarray operator>>(const T&, const valarray&); +template valarray operator&& + (const valarray&, const valarray&); +template valarray operator&&(const valarray&, const T&); +template valarray operator&&(const T&, const valarray&); +template valarray operator|| + (const valarray&, const valarray&); +template valarray operator||(const valarray&, const T&); +template valarray operator||(const T&, const valarray&); + + template + valarray operator==(const valarray&, const valarray&); + template valarray operator==(const valarray&, const T&); + template valarray operator==(const T&, const valarray&); + template + valarray operator!=(const valarray&, const valarray&); + template valarray operator!=(const valarray&, const T&); + template valarray operator!=(const T&, const valarray&); + template + valarray operator< (const valarray&, const valarray&); + template valarray operator< (const valarray&, const T&); + template valarray operator< (const T&, const valarray&); + template + valarray operator> (const valarray&, const valarray&); + template valarray operator> (const valarray&, const T&); + template valarray operator> (const T&, const valarray&); + template + valarray operator<=(const valarray&, const valarray&); + template valarray operator<=(const valarray&, const T&); + template valarray operator<=(const T&, const valarray&); + template + valarray operator>=(const valarray&, const valarray&); + template valarray operator>=(const valarray&, const T&); + template valarray operator>=(const T&, const valarray&); + template valarray abs (const valarray&); + template valarray acos (const valarray&); + template valarray asin (const valarray&); + template valarray atan (const valarray&); + template valarray atan2 + (const valarray&, const valarray&); + template valarray atan2(const valarray&, const T&); + template valarray atan2(const T&, const valarray&); + template valarray cos (const valarray&); + template valarray cosh (const valarray&); + template valarray exp (const valarray&); + template valarray log (const valarray&); + template valarray log10(const valarray&); + template valarray pow(const valarray&, const valarray&); + template valarray pow(const valarray&, const T&); + template valarray pow(const T&, const valarray&); + template valarray sin (const valarray&); + template valarray sinh (const valarray&); + template valarray sqrt (const valarray&); + template valarray tan (const valarray&); + template valarray tanh (const valarray&); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/valarray/types_std.cc b/libstdc++-v3/testsuite/26_numerics/headers/valarray/types_std.cc new file mode 100644 index 000000000..7c47f27f6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/valarray/types_std.cc @@ -0,0 +1,26 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace gnu +{ + typedef std::slice t1; + typedef std::gslice t2; +} diff --git a/libstdc++-v3/testsuite/26_numerics/inner_product/1.cc b/libstdc++-v3/testsuite/26_numerics/inner_product/1.cc new file mode 100644 index 000000000..c3d17b924 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/inner_product/1.cc @@ -0,0 +1,56 @@ +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.2 [lib.inner_product] + +#include +#include + +int A1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +int A2[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; +const int NA = sizeof(A1) / sizeof(int); + +bool B1[] = {false, true, true, false, true, false, true, true, false, true}; +bool B2[] = {true, false, true, true, false, true, false, true, true, false}; +const int NB = sizeof(B1) / sizeof(bool); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int res = std::inner_product(A1, A1 + NA, A2, 31); + VERIFY( res == 983 ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + + int res = std::inner_product(B1, B1 + NB, B2, 100); + VERIFY( res == 102 ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..e00171fbe --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template value_type inner_product(iterator_type, iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc new file mode 100644 index 000000000..303c56abf --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template value_type inner_product(iterator_type, iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/iota/1.cc b/libstdc++-v3/testsuite/26_numerics/iota/1.cc new file mode 100644 index 000000000..3293b13e8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/iota/1.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-27 Paolo Carlini + +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +int A[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; +int C[] = {-9, -8, -7, -6, -5, -4, -3, -2, -1}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::iota(A, A + N, 1); + VERIFY( std::equal(A, A + N, B) ); + + std::iota(A, A + N, -9); + VERIFY( std::equal(A, A + N, C) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..ff4530e06 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/2.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2008-06-27 Paolo Carlini + +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + typedef __gnu_test::NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template void iota(iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/pod.cc new file mode 100644 index 000000000..ee14829a6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/iota/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,33 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2008-06-27 Paolo Carlini + +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + typedef __gnu_test::pod_int value_type; + typedef value_type* iterator_type; + + template void iota(iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc b/libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc new file mode 100644 index 000000000..8c49ddaaf --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc @@ -0,0 +1,45 @@ +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3 [lib.partial.sum] + +#include +#include +#include + +int A[] = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100}; +int B[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int D[N]; + + std::partial_sum(B, B + N, D); + VERIFY( std::equal(D, D + N, A) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc new file mode 100644 index 000000000..edd6b6e82 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc @@ -0,0 +1,35 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template output_iterator partial_sum(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc new file mode 100644 index 000000000..6871a7416 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,35 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template output_iterator partial_sum(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc new file mode 100644 index 000000000..16e56f805 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::bernoulli_distribution u; + VERIFY( u.p() == 0.5 ); + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc new file mode 100644 index 000000000..9742e273a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::bernoulli_distribution u(0.75); + VERIFY( u.p() == 0.75 ); + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/equal.cc new file mode 100644 index 000000000..b3e8b9702 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::bernoulli_distribution u(0.75), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/inequal.cc new file mode 100644 index 000000000..6ed72faa1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::bernoulli_distribution u(0.75), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc new file mode 100644 index 000000000..3677ba7dd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::bernoulli_distribution u(0.75), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..adea635e9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::bernoulli_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc new file mode 100644 index 000000000..25fe4fbc5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::binomial_distribution<> u; + VERIFY( u.t() == 1 ); + VERIFY( u.p() == 0.5 ); + VERIFY( u.min() == 0 ); + VERIFY( u.max() == u.t() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc new file mode 100644 index 000000000..4381c6ea4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::binomial_distribution<> u(3, 0.75); + VERIFY( u.t() == 3 ); + VERIFY( u.p() == 0.75 ); + VERIFY( u.min() == 0 ); + VERIFY( u.max() == u.t() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/equal.cc new file mode 100644 index 000000000..9002614d4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::binomial_distribution u(3, 0.75), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/inequal.cc new file mode 100644 index 000000000..fb05a0daa --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::binomial_distribution u(3, 0.75), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc new file mode 100644 index 000000000..fb65018b9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +void +test01() +{ + std::stringstream str; + std::binomial_distribution u(3, 0.75), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..e60fac13c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::binomial_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc new file mode 100644 index 000000000..85a5c278c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.4 Class template cauchy_distribution [rand.dist.norm.cauchy] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::cauchy_distribution<> u; + VERIFY( u.a() == 0.0 ); + VERIFY( u.b() == 1.0 ); + typedef std::cauchy_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc new file mode 100644 index 000000000..54f6f81b3 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.4 Class template cauchy_distribution [rand.dist.norm.cauchy] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::cauchy_distribution<> u(5.0, 2.0); + VERIFY( u.a() == 5.0 ); + VERIFY( u.b() == 2.0 ); + typedef std::cauchy_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/equal.cc new file mode 100644 index 000000000..068c8ca04 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.4 class template cauchy_distribution [rand.dist.norm.cauchy] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::cauchy_distribution u(5.0, 2.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/inequal.cc new file mode 100644 index 000000000..de1e6f63c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.4 class template cauchy_distribution [rand.dist.norm.cauchy] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::cauchy_distribution u(5.0, 2.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc new file mode 100644 index 000000000..fd0d5f9db --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::cauchy_distribution u(5.0, 2.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..3d80d2ddf --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.4 Class template cauchy_distribution [rand.dist.norm.cauchy] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::cauchy_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc new file mode 100644 index 000000000..88e5ebb4c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::chi_squared_distribution<> u; + VERIFY( u.n() == 1 ); + typedef std::chi_squared_distribution<>::result_type result_type; + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc new file mode 100644 index 000000000..a720aab5f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::chi_squared_distribution<> u(1.5); + VERIFY( u.n() == 1.5 ); + typedef std::chi_squared_distribution<>::result_type result_type; + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/equal.cc new file mode 100644 index 000000000..e84e1046f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::chi_squared_distribution u(1.5), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/inequal.cc new file mode 100644 index 000000000..eb95739ef --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::chi_squared_distribution u(1.5), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc new file mode 100644 index 000000000..146eeae51 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::chi_squared_distribution u(1.5), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..271e0fe45 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::chi_squared_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc b/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc new file mode 100644 index 000000000..3fef87d0c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [10] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::default_random_engine a; + a.discard(9999); + + // This is our choice for now. + std::minstd_rand0 b; + b.discard(9999); + + assert( a() == b() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc new file mode 100644 index 000000000..ded2205b1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef std::subtract_with_carry_engine + base_engine; + + base_engine b; + + std::discard_block_engine e(b); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc new file mode 100644 index 000000000..4f903e530 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef std::subtract_with_carry_engine + base_engine; + + std::discard_block_engine + e(std::move(base_engine())); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc new file mode 100644 index 000000000..6010c536c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/copy.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > e(1); + + const auto f(e); + auto g(f); + g = g; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc new file mode 100644 index 000000000..0868f8f4a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > e; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc new file mode 100644 index 000000000..ae9f2b4ce --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + unsigned long seed = 2; + + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > e(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc new file mode 100644 index 000000000..edf40b08c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + double seed = 2.0; + + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > e(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc new file mode 100644 index 000000000..c1f841a46 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::seed_seq seq; + + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > e(seq); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc new file mode 100644 index 000000000..5d63114fe --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > u, v; + + VERIFY( u == v ); + + u.discard(100); + v.discard(100); + + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/inequal.cc new file mode 100644 index 000000000..fff369b1b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/inequal.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.4.1 class template discard_block_engine [rand.adapt.disc] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > u, v; + + VERIFY( !(u != v) ); + + u.discard(100); + v.discard(100); + + VERIFY( !(u != v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc new file mode 100644 index 000000000..7aec649c0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::stringstream str; + std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > u, v; + + u(); // advance + str << u; + + VERIFY( !(u == v) ); + + str >> v; + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc new file mode 100644 index 000000000..1c70881fc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_data.cc @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_data + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::block_size; + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::used_block; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc new file mode 100644 index 000000000..77f4fb578 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/constexpr_functions.cc @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::min(); + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::max(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc new file mode 100644 index 000000000..6e23316ca --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc @@ -0,0 +1,39 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 Class template discard_blockl_engine [rand.adapt.disc] +// 26.4.2.3 Concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include + +void +test01() +{ + typedef std::discard_block_engine + < + std::subtract_with_carry_engine, + 389, 24 + > test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc new file mode 100644 index 000000000..9d05b1982 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::discrete_distribution<> u; + std::vector probablility = u.probabilities(); + VERIFY( probablility.size() == 1 ); + VERIFY( probablility[0] == 1.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc new file mode 100644 index 000000000..3bcb7448e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::discrete_distribution<> u({0.0, 2.0, 4.0, 3.0, 4.0, 0.0}); + std::vector probablility = u.probabilities(); + VERIFY( probablility.size() == 6 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc new file mode 100644 index 000000000..12282f0f4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc @@ -0,0 +1,70 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +struct cosine_distribution +{ + cosine_distribution(double x0, double lambda) + : _M_x0(x0), _M_lambda(lambda) + { } + + double + operator()(double x) + { + if (x - _M_x0 < -_M_lambda / 4) + return 0.0; + else if (x - _M_x0 > _M_lambda / 4) + return 0.0; + else + { + const double pi = 3.14159265358979323846; + return std::cos(2 * pi * (x - _M_x0) / _M_lambda); + } + } + +private: + double _M_x0; + double _M_lambda; +}; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + cosine_distribution cd(1.5, 3.0); + std::discrete_distribution<> u(21, -10.0, 10.0, cd); + std::vector probablility = u.probabilities(); + VERIFY( probablility.size() == 21 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc new file mode 100644 index 000000000..aa8d9567f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector wt = {0.5, 1.0, 2.5, 1.5, 0.5}; + std::discrete_distribution<> u(wt.begin(), wt.end()); + std::vector probablility = u.probabilities(); + VERIFY( probablility.size() == 5 ); + VERIFY( probablility[0] == 0.5 / 6.0 ); + VERIFY( probablility[2] == 2.5 / 6.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/call-default.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/call-default.cc new file mode 100644 index 000000000..11e0d6879 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/call-default.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-10-13 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.1 Class template discrete_distribution +// [rand.dist.samp.discrete] + +#include + +void +test01() +{ + std::discrete_distribution<> u; + std::minstd_rand0 rng; + + u(rng); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/equal.cc new file mode 100644 index 000000000..6ef26c9c6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/equal.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector wt = { 0.5, 1.0, 2.5, 1.5, 0.5 }; + std::discrete_distribution u(wt.begin(), wt.end()), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/inequal.cc new file mode 100644 index 000000000..2215a7008 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/inequal.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector wt = { 0.5, 1.0, 2.5, 1.5, 0.5 }; + std::discrete_distribution u(wt.begin(), wt.end()), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc new file mode 100644 index 000000000..c2ba51a12 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::vector wt = {0.5, 1.0, 2.5, 1.5, 0.5}; + std::discrete_distribution u(wt.begin(), wt.end()), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..7c5977b38 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::discrete_distribution<> test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc new file mode 100644 index 000000000..97168ff02 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::exponential_distribution<> u; + VERIFY( u.lambda() == 1.0 ); + typedef std::exponential_distribution<>::result_type result_type; + VERIFY( u.min() == 0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc new file mode 100644 index 000000000..6c2535fa0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::exponential_distribution<> u(0.5); + VERIFY( u.lambda() == 0.5 ); + typedef std::exponential_distribution<>::result_type result_type; + VERIFY( u.min() == 0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/equal.cc new file mode 100644 index 000000000..e4a30bba6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::exponential_distribution u(0.5), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/inequal.cc new file mode 100644 index 000000000..a3fbc2fbc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::exponential_distribution u(0.5), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc new file mode 100644 index 000000000..d1dca74c6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::exponential_distribution u(0.5), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..7c696e252 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::exponential_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc new file mode 100644 index 000000000..542909588 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::extreme_value_distribution<> u; + VERIFY( u.a() == 0.0 ); + VERIFY( u.b() == 1.0 ); + typedef std::extreme_value_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc new file mode 100644 index 000000000..d0374cd5c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::extreme_value_distribution<> u(5.0, 2.0); + VERIFY( u.a() == 5.0 ); + VERIFY( u.b() == 2.0 ); + typedef std::extreme_value_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/equal.cc new file mode 100644 index 000000000..85e78a60c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::extreme_value_distribution u(5.0, 2.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/inequal.cc new file mode 100644 index 000000000..dbc65f837 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::extreme_value_distribution u(5.0, 2.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc new file mode 100644 index 000000000..2f68409b9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::extreme_value_distribution u, v(5.0, 2.0); + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..8f5d99da4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::extreme_value_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc new file mode 100644 index 000000000..d3e8ae968 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::fisher_f_distribution<> u; + VERIFY( u.m() == 1.0 ); + VERIFY( u.n() == 1.0 ); + typedef std::fisher_f_distribution<>::result_type result_type; + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc new file mode 100644 index 000000000..15133aba1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::fisher_f_distribution<> u(2.0, 3.0); + VERIFY( u.m() == 2.0 ); + VERIFY( u.n() == 3.0 ); + typedef std::fisher_f_distribution<>::result_type result_type; + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/equal.cc new file mode 100644 index 000000000..bedb79e71 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::fisher_f_distribution u(2.0, 3.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/inequal.cc new file mode 100644 index 000000000..ae19853a0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::fisher_f_distribution u(2.0, 3.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc new file mode 100644 index 000000000..52640f3fc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::fisher_f_distribution u(2.0, 3.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..a92727d70 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::fisher_f_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc new file mode 100644 index 000000000..378eca23b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::gamma_distribution<> u; + VERIFY( u.alpha() == 1.0 ); + VERIFY( u.beta() == 1.0 ); + VERIFY( u.min() == 0.0 ); + typedef std::gamma_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc new file mode 100644 index 000000000..c400c98df --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::gamma_distribution<> u(1.5, 3.0); + VERIFY( u.alpha() == 1.5 ); + VERIFY( u.beta() == 3.0 ); + VERIFY( u.min() == 0.0 ); + typedef std::gamma_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/equal.cc new file mode 100644 index 000000000..131132f04 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::gamma_distribution u(1.5, 3.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/inequal.cc new file mode 100644 index 000000000..1fe8057da --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::gamma_distribution u(1.5, 3.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc new file mode 100644 index 000000000..0c24b7a5b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::gamma_distribution u(1.5, 3.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..a1d15575e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::gamma_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc new file mode 100644 index 000000000..353193bbd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geo] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::geometric_distribution<> u; + VERIFY( u.p() == 0.5 ); + VERIFY( u.min() == 0 ); + typedef std::geometric_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc new file mode 100644 index 000000000..ddc667675 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geo] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::geometric_distribution<> u(0.75); + VERIFY( u.p() == 0.75 ); + VERIFY( u.min() == 0 ); + typedef std::geometric_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/equal.cc new file mode 100644 index 000000000..bd20f9262 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.3 Class template geometric_distribution [rand.dist.bern.geom] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::geometric_distribution u(0.75), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/inequal.cc new file mode 100644 index 000000000..19031ccf3 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.3 Class template geometric_distribution [rand.dist.bern.geom] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::geometric_distribution u(0.75), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc new file mode 100644 index 000000000..75de1b88c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geom] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::geometric_distribution u(0.75), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..cc03ebf0d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geom] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::geometric_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc new file mode 100644 index 000000000..81d5d8f18 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef std::subtract_with_carry_engine + base_engine; + + base_engine b; + + std::independent_bits_engine e(b); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc new file mode 100644 index 000000000..c5747b306 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef std::subtract_with_carry_engine + base_engine; + + std::independent_bits_engine + e(std::move(base_engine())); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc new file mode 100644 index 000000000..111af1964 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/copy.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::independent_bits_engine + < + std::subtract_with_carry_engine, + 48, + uint_fast64_t + > e(1); + + const auto f(e); + auto g(f); + g = g; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc new file mode 100644 index 000000000..781e7a9e2 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::independent_bits_engine + < + std::subtract_with_carry_engine, + 48, + uint_fast64_t + > e; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc new file mode 100644 index 000000000..890045d86 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + unsigned long seed = 2; + + std::independent_bits_engine + < + std::subtract_with_carry_engine, + 48, + uint_fast64_t + > e(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc new file mode 100644 index 000000000..973ddd4dc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + double seed = 2.0; + + std::independent_bits_engine + < + std::subtract_with_carry_engine, + 48, + uint_fast64_t + > e(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc new file mode 100644 index 000000000..dcaed2d75 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::seed_seq seq; + + std::independent_bits_engine + < + std::subtract_with_carry_engine, + 48, + uint_fast64_t + > e(seq); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc new file mode 100644 index 000000000..18d05140d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::independent_bits_engine + , + 48, uint_fast64_t> u, v; + + VERIFY( u == v ); + + u.discard(100); + v.discard(100); + + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/inequal.cc new file mode 100644 index 000000000..a1e05a715 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/inequal.cc @@ -0,0 +1,49 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.4.2 class template independent_bits_engine [rand.adapt.bits] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::independent_bits_engine + , + 48, uint_fast64_t> u, v; + + VERIFY( !(u != v) ); + + u.discard(100); + v.discard(100); + + VERIFY( !(u != v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc new file mode 100644 index 000000000..332931add --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::stringstream str; + std::independent_bits_engine + , + 48, uint_fast64_t> u, v; + + u(); // advance + str << u; + + VERIFY( !(u == v) ); + + str >> v; + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc new file mode 100644 index 000000000..b10d36fb7 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/constexpr_functions.cc @@ -0,0 +1,62 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::min(); + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::max(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::independent_bits_engine + < + std::subtract_with_carry_engine + < + uint_fast64_t, 48, 5, 12 + >, + 48, uint_fast64_t + > type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc new file mode 100644 index 000000000..0402a0966 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc @@ -0,0 +1,42 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.2 class template independent_bits_engine [rand.adapt.ibits] +// 26.4.2.3 Concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include + +void +test01() +{ + typedef std::independent_bits_engine + < + std::subtract_with_carry_engine + < + uint_fast64_t, 48, 5, 12 + >, + 48, uint_fast64_t + > test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc b/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc new file mode 100644 index 000000000..ba4016eab --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [9] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::knuth_b a; + a.discard(9999); + + VERIFY( a() == 1112339016 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc new file mode 100644 index 000000000..6f5b8d297 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/copy.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::linear_congruential_engine e(1); + + const auto f(e); + auto g(f); + g = g; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc new file mode 100644 index 000000000..42ca73c73 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::linear_congruential_engine x; + VERIFY( x.min() == 1 ); + VERIFY( x.max() == 2147483647-1 ); + VERIFY( x() == 48271 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc new file mode 100644 index 000000000..06d04775b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + unsigned long seed = 2; + std::linear_congruential_engine x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc new file mode 100644 index 000000000..1fa23dff2 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + double seed = 2.0; + std::linear_congruential_engine x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq.cc new file mode 100644 index 000000000..d09d83824 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-01 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::seed_seq seed; + std::linear_congruential_engine x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc new file mode 100644 index 000000000..5f555db48 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::minstd_rand0 a; + std::minstd_rand0 b; + std::minstd_rand0 c(120); + + VERIFY( a == b ); + VERIFY( !(a == c) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/inequal.cc new file mode 100644 index 000000000..768837a30 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/inequal.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.3.1 class template linear_congruential_engine [rand.eng.lcong] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::minstd_rand0 a; + std::minstd_rand0 b; + std::minstd_rand0 c(120); + + VERIFY( a != c ); + VERIFY( !(a != b) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc new file mode 100644 index 000000000..8b67e5f3a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::stringstream str; + std::minstd_rand0 a; + std::minstd_rand0 b; + + a(); // advance + str << a; + VERIFY( !(a == b) ); + + str >> b; + VERIFY( a == b ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc new file mode 100644 index 000000000..2b48164fb --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constants.cc @@ -0,0 +1,41 @@ +// { dg-do link } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-09-29 Paolo Carlini +// +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ + std::minstd_rand0 lc; + + const void* p = &lc.multiplier; + p = &lc.increment; + p = &lc.modulus; + p = &lc.default_seed; + p = p; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc new file mode 100644 index 000000000..1e8171b5c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_data + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::multiplier; + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::increment; + constexpr auto v3 __attribute__((unused)) + = _Ttesttype::modulus; + constexpr auto v4 __attribute__((unused)) + = _Ttesttype::default_seed; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::linear_congruential_engine type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc new file mode 100644 index 000000000..7917a9906 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::min(); + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::max(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::linear_congruential_engine type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc new file mode 100644 index 000000000..18fb44fda --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc @@ -0,0 +1,33 @@ +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// { dg-error "not a valid type" "" { target *-*-* } 32 } +// { dg-error "invalid type" "" { target *-*-* } 32 } + +// 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include + +std::linear_congruential_engine x; + diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc new file mode 100644 index 000000000..993f79354 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include + +void +test01() +{ + typedef std::linear_congruential_engine test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc new file mode 100644 index 000000000..9607fd3e8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::lognormal_distribution<> u; + VERIFY( u.m() == 0.0 ); + VERIFY( u.s() == 1.0 ); + typedef std::lognormal_distribution<>::result_type result_type; + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc new file mode 100644 index 000000000..a18f93508 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::lognormal_distribution<> u(5.0, 2.0); + VERIFY( u.m() == 5.0 ); + VERIFY( u.s() == 2.0 ); + typedef std::lognormal_distribution<>::result_type result_type; + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/equal.cc new file mode 100644 index 000000000..684c0ca93 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::lognormal_distribution u(5.0, 2.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/inequal.cc new file mode 100644 index 000000000..ce427e573 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::lognormal_distribution u(5.0, 2.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc new file mode 100644 index 000000000..877b6aab5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::lognormal_distribution u(5.0, 2.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..2e3ade699 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::lognormal_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc new file mode 100644 index 000000000..98ea4fe03 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/copy.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef unsigned long value_type; + + std::mersenne_twister_engine< + value_type, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> e(1); + + const auto f(e); + auto g(f); + g = g; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc new file mode 100644 index 000000000..be5716080 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + typedef unsigned long value_type; + + std::mersenne_twister_engine< + value_type, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> x; + + VERIFY( x.min() == 0 ); + VERIFY( x.max() == 4294967295ul ); + VERIFY( x() == 3499211612ul ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc new file mode 100644 index 000000000..cf24ffe13 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + unsigned long seed = 2; + std::mersenne_twister_engine< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc new file mode 100644 index 000000000..425e5be7d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + double seed = 2.0; + std::mersenne_twister_engine< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq.cc new file mode 100644 index 000000000..aa98c9b93 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-01 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::seed_seq seed; + std::mersenne_twister_engine< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc new file mode 100644 index 000000000..7e482a8cd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.2 Class template mersenne_twister_engine [rand.eng.mers] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::mersenne_twister_engine< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> u, v; + + VERIFY( u == v ); + + u.discard(100); + v.discard(100); + + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/inequal.cc new file mode 100644 index 000000000..94ccb76f7 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/inequal.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.3.2 Class template mersenne_twister_engine [rand.eng.mers] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::mersenne_twister_engine< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> u, v; + + VERIFY( !(u != v) ); + + u.discard(100); + v.discard(100); + + VERIFY( !(u != v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc new file mode 100644 index 000000000..03fb8b04f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.2 Class template mersenne_twister_engine [rand.eng.mers] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::stringstream str; + std::mersenne_twister_engine< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, + 0xfffffffful, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18, 1812433253ul> u, v; + + u(); // advance + str << u; + + VERIFY( !(u == v) ); + + str >> v; + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc new file mode 100644 index 000000000..ad38bec01 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constants.cc @@ -0,0 +1,51 @@ +// { dg-do link } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-09-29 Paolo Carlini +// +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ + std::mt19937 mt; + + const void* p = &mt.word_size; + p = &mt.state_size; + p = &mt.shift_size; + p = &mt.mask_bits; + p = &mt.xor_mask; + p = &mt.tempering_u; + p = &mt.tempering_d; + p = &mt.tempering_s; + p = &mt.tempering_b; + p = &mt.tempering_t; + p = &mt.tempering_c; + p = &mt.tempering_l; + p = &mt.initialization_multiplier; + p = &mt.default_seed; + p = p; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc new file mode 100644 index 000000000..4a27982b4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_data.cc @@ -0,0 +1,79 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_data + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::word_size; + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::state_size; + constexpr auto v3 __attribute__((unused)) + = _Ttesttype::shift_size; + constexpr auto v4 __attribute__((unused)) + = _Ttesttype::mask_bits; + constexpr auto v5 __attribute__((unused)) + = _Ttesttype::xor_mask; + constexpr auto v6 __attribute__((unused)) + = _Ttesttype::tempering_u; + constexpr auto v7 __attribute__((unused)) + = _Ttesttype::tempering_d; + constexpr auto v8 __attribute__((unused)) + = _Ttesttype::tempering_s; + constexpr auto v9 __attribute__((unused)) + = _Ttesttype::tempering_b; + constexpr auto v10 __attribute__((unused)) + = _Ttesttype::tempering_t; + constexpr auto v11 __attribute__((unused)) + = _Ttesttype::tempering_c; + constexpr auto v12 __attribute__((unused)) + = _Ttesttype::tempering_l; + constexpr auto v13 __attribute__((unused)) + = _Ttesttype::initialization_multiplier; + constexpr auto v14 __attribute__((unused)) + = _Ttesttype::default_seed; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::mt19937 type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc new file mode 100644 index 000000000..03513acf8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/constexpr_functions.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::min(); + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::max(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::mt19937 type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc new file mode 100644 index 000000000..7ea898a1e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc @@ -0,0 +1,40 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.2 Class template mersenne_twister_engine [rand.eng.mers] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include + +void +test01() +{ + typedef std::mersenne_twister_engine test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc new file mode 100644 index 000000000..33f5c0355 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines with predefined parameters +// 26.4.5 [2] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::minstd_rand a; + a.discard(9999); + + VERIFY( a() == 399268537 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc new file mode 100644 index 000000000..51716b3c9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [1] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::minstd_rand0 a; + a.discard(9999); + + VERIFY( a() == 1043618065 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc b/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc new file mode 100644 index 000000000..2703ae3e8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [3] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::mt19937 a; + a.discard(9999); + + VERIFY( a() == 4123659995ul ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc b/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc new file mode 100644 index 000000000..47ef8cfcf --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [4] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::mt19937_64 a; + a.discard(9999); + + VERIFY( a() == 9981545732273789042ull ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc new file mode 100644 index 000000000..02a7836ef --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.4 Class template negative_binomial_distribution [rand.dist.bern.negbin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::negative_binomial_distribution<> u; + VERIFY( u.k() == 1 ); + VERIFY( u.p() == 0.5 ); + typedef std::negative_binomial_distribution<>::result_type result_type; + VERIFY( u.min() == 0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc new file mode 100644 index 000000000..3db9c0bd1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.4 Class template negative_binomial_distribution [rand.dist.bern.negbin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::negative_binomial_distribution<> u(3, 0.75); + VERIFY( u.k() == 3 ); + VERIFY( u.p() == 0.75 ); + typedef std::negative_binomial_distribution<>::result_type result_type; + VERIFY( u.min() == 0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/equal.cc new file mode 100644 index 000000000..08ec8938f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/equal.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.4 Class template negative_binomial_distribution +// [rand.dist.bern.negbin] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::negative_binomial_distribution u(3, 0.75), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/inequal.cc new file mode 100644 index 000000000..86d23e770 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/inequal.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.2.4 Class template negative_binomial_distribution +// [rand.dist.bern.negbin] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::negative_binomial_distribution u(3, 0.75), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc new file mode 100644 index 000000000..7320f5224 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.4 Class template negative_binomial_distribution +// [rand.dist.bern.negbin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::negative_binomial_distribution u(3, 0.75), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..5b30fda67 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.2.4 Class template negative_binomial_distribution [rand.dist.bern.negbin] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::negative_binomial_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc new file mode 100644 index 000000000..fca0cc188 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::normal_distribution<> u; + VERIFY( u.mean() == 0.0 ); + VERIFY( u.stddev() == 1.0 ); + typedef std::normal_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc new file mode 100644 index 000000000..ea3113dd0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::normal_distribution<> u(5.0, 2.0); + VERIFY( u.mean() == 5.0 ); + VERIFY( u.stddev() == 2.0 ); + typedef std::normal_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/equal.cc new file mode 100644 index 000000000..6dac4b386 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.1 Class template normal_distribution [rand.dist.norm.normal] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::normal_distribution u(5.0, 2.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/inequal.cc new file mode 100644 index 000000000..e3a31f68e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.1 Class template normal_distribution [rand.dist.norm.normal] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::normal_distribution u(5.0, 2.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc new file mode 100644 index 000000000..c88e0a19b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::normal_distribution u(5.0, 2.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..471379d55 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::normal_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc new file mode 100644 index 000000000..cdfa3d061 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::piecewise_constant_distribution<> u; + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 2 ); + VERIFY( interval[0] == 0.0 ); + VERIFY( interval[1] == 1.0 ); + VERIFY( density.size() == 1 ); + VERIFY( density[0] == 1.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc new file mode 100644 index 000000000..7ae5d89be --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc @@ -0,0 +1,75 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.2 Class template piecewise_constant_distribution +// [rand.dist.samp.pconst] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +struct cosine_distribution +{ + cosine_distribution(double x0, double lambda) + : _M_x0(x0), _M_lambda(lambda) + { } + + double + operator()(double x) + { + if (x - _M_x0 < -_M_lambda / 4) + return 0.0; + else if (x - _M_x0 > _M_lambda / 4) + return 0.0; + else + { + const double pi = 3.14159265358979323846; + return std::cos(2 * pi * (x - _M_x0) / _M_lambda); + } + } + +private: + double _M_x0; + double _M_lambda; +}; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + cosine_distribution cd(1.5, 3.0); + std::piecewise_constant_distribution<> u({-10.0, -8.0, -6.0, -4.0, -2.0, + 0.0, 2.0, 4.0, 6.0, 8.0, 10.0}, + cd); + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 11 ); + VERIFY( density.size() == 10 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc new file mode 100644 index 000000000..a7c7589fe --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.2 Class template piecewise_constant_distribution +// [rand.dist.samp.pconst] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +struct cosine_distribution +{ + cosine_distribution(double x0, double lambda) + : _M_x0(x0), _M_lambda(lambda) + { } + + double + operator()(double x) + { + if (x - _M_x0 < -_M_lambda / 4) + return 0.0; + else if (x - _M_x0 > _M_lambda / 4) + return 0.0; + else + { + const double pi = 3.14159265358979323846; + return std::cos(2 * pi * (x - _M_x0) / _M_lambda); + } + } + +private: + double _M_x0; + double _M_lambda; +}; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + cosine_distribution cd(1.5, 3.0); + std::piecewise_constant_distribution<> u(21, -10.0, 10.0, cd); + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 22 ); + VERIFY( density.size() == 21 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc new file mode 100644 index 000000000..d0f7dbf53 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + std::vector wt = {0.5, 1.0, 2.5, 1.5, 0.5}; + std::piecewise_constant_distribution<> u(x.begin(), x.end(), wt.begin()); + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 6 ); + VERIFY( interval[0] == 0.0 ); + VERIFY( interval[5] == 5.0 ); + VERIFY( density.size() == 5 ); + VERIFY( density[0] == 0.5 / 6.0 ); + VERIFY( density[2] == 2.5 / 6.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/call-default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/call-default.cc new file mode 100644 index 000000000..fe2b9620a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/call-default.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-10-13 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.2 Class template piecewise_constant_distribution +// [rand.dist.samp.pconst] + +#include + +void +test01() +{ + std::piecewise_constant_distribution<> u; + std::minstd_rand0 rng; + + u(rng); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/equal.cc new file mode 100644 index 000000000..fc74cf11a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/equal.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.2 Class template piecewise_constant_distribution +// [rand.dist.samp.pconst] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 }; + std::vector wt = { 0.5, 1.0, 2.5, 1.5, 0.5 }; + std::piecewise_constant_distribution + u(x.begin(), x.end(), wt.begin()), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/inequal.cc new file mode 100644 index 000000000..dec264d1c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/inequal.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.2 Class template piecewise_constant_distribution +// [rand.dist.samp.pconst] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 }; + std::vector wt = { 0.5, 1.0, 2.5, 1.5, 0.5 }; + std::piecewise_constant_distribution + u(x.begin(), x.end(), wt.begin()), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc new file mode 100644 index 000000000..e1136796d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.2 Class template piecewise_constant_distribution +// [rand.dist.samp.pconst] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::vector x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + std::vector wt = {0.5, 1.0, 2.5, 1.5, 0.5}; + std::piecewise_constant_distribution + u(x.begin(), x.end(), wt.begin()), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..c0d458ef6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::piecewise_constant_distribution<> test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc new file mode 100644 index 000000000..d2db1765a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc @@ -0,0 +1,49 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::piecewise_linear_distribution<> u; + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 2 ); + VERIFY( interval[0] == 0.0 ); + VERIFY( interval[1] == 1.0 ); + VERIFY( density.size() == 2 ); + VERIFY( density[0] == 1.0 ); + VERIFY( density[1] == 1.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc new file mode 100644 index 000000000..564aeeea2 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc @@ -0,0 +1,75 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.3 Class template piecewise_linear_distribution +// [rand.dist.samp.plinear] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +struct cosine_distribution +{ + cosine_distribution(double x0, double lambda) + : _M_x0(x0), _M_lambda(lambda) + { } + + double + operator()(double x) + { + if (x - _M_x0 < -_M_lambda / 4) + return 0.0; + else if (x - _M_x0 > _M_lambda / 4) + return 0.0; + else + { + const double pi = 3.14159265358979323846; + return std::cos(2 * pi * (x - _M_x0) / _M_lambda); + } + } + +private: + double _M_x0; + double _M_lambda; +}; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + cosine_distribution cd(1.5, 3.0); + std::piecewise_linear_distribution<> u({-10.0, -8.0, -6.0, -4.0, -2.0, + 0.0, 2.0, 4.0, 6.0, 8.0, 10.0}, + cd); + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 11 ); + VERIFY( density.size() == 11 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc new file mode 100644 index 000000000..e4eb0e8fe --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.3 Class template piecewise_linear_distribution +// [rand.dist.samp.plinear] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +struct cosine_distribution +{ + cosine_distribution(double x0, double lambda) + : _M_x0(x0), _M_lambda(lambda) + { } + + double + operator()(double x) + { + if (x - _M_x0 < -_M_lambda / 4) + return 0.0; + else if (x - _M_x0 > _M_lambda / 4) + return 0.0; + else + { + const double pi = 3.14159265358979323846; + return std::cos(2 * pi * (x - _M_x0) / _M_lambda); + } + } + +private: + double _M_x0; + double _M_lambda; +}; + +void +test01() +{ + bool test __attribute__((unused)) = true; + + cosine_distribution cd(1.5, 3.0); + std::piecewise_linear_distribution<> u(21, -10.0, 10.0, cd); + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 22 ); + VERIFY( density.size() == 22 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc new file mode 100644 index 000000000..56be0ad9b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + std::vector wt = {0.0, 1.0, 2.5, 1.5, 3.5, 0.0}; + std::piecewise_linear_distribution<> u(x.begin(), x.end(), wt.begin()); + std::vector interval = u.intervals(); + std::vector density = u.densities(); + VERIFY( interval.size() == 6 ); + VERIFY( interval[0] == 0.0 ); + VERIFY( interval[5] == 5.0 ); + VERIFY( density.size() == 6 ); + VERIFY( density[0] == 0.0 ); + VERIFY( density[4] == 3.5 / 8.5 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/call-default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/call-default.cc new file mode 100644 index 000000000..426c4d837 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/call-default.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-10-12 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.3 Class template piecewise_linear_distribution +// [rand.dist.samp.plinear] + +#include + +void +test01() +{ + std::piecewise_linear_distribution<> u; + std::minstd_rand0 rng; + + u(rng); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/equal.cc new file mode 100644 index 000000000..c3510b9cc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/equal.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.3 Class template piecewise_linear_distribution +// [rand.dist.samp.plinear] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 }; + std::vector wt = { 0.0, 1.0, 2.5, 1.5, 0.5, 0.0 }; + std::piecewise_linear_distribution + u(x.begin(), x.end(), wt.begin()), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/inequal.cc new file mode 100644 index 000000000..bbb96dc0e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/inequal.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.5.3 Class template piecewise_linear_distribution +// [rand.dist.samp.plinear] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 }; + std::vector wt = { 0.0, 1.0, 2.5, 1.5, 0.5, 0.0 }; + std::piecewise_linear_distribution + u(x.begin(), x.end(), wt.begin()), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc new file mode 100644 index 000000000..75ea5a700 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.3 Class template piecewise_linear_distribution +// [rand.dist.samp.plinear] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::vector x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; + std::vector wt = {0.0, 1.0, 2.5, 1.5, 0.5, 0.0}; + std::piecewise_linear_distribution + u(x.begin(), x.end(), wt.begin()), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..cb1d016dc --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.5.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::piecewise_linear_distribution<> test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc new file mode 100644 index 000000000..df396c4c0 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::poisson_distribution<> u; + VERIFY( u.mean() == 1.0 ); + VERIFY( u.min() == 0 ); + typedef std::poisson_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc new file mode 100644 index 000000000..728587bd2 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::poisson_distribution<> u(5.0); + VERIFY( u.mean() == 5.0 ); + VERIFY( u.min() == 0 ); + typedef std::poisson_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/equal.cc new file mode 100644 index 000000000..3ded153fe --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::poisson_distribution u(5.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/inequal.cc new file mode 100644 index 000000000..a996dc154 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::poisson_distribution u(5.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc new file mode 100644 index 000000000..315e309db --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::poisson_distribution u(5.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..d6a600293 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::poisson_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc new file mode 100644 index 000000000..2e21ab6a9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.6 class random_device [rand.device] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::random_device x; + + VERIFY( x.min() == std::numeric_limits::min() ); + VERIFY( x.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc new file mode 100644 index 000000000..638134cf4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.6 class random_device [rand.device] +// 26.4.6 [3] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + +#ifdef _GLIBCXX_USE_RANDOM_TR1 + std::random_device x("/dev/random"); +#else + std::random_device x("0"); +#endif + + VERIFY( x.min() == std::numeric_limits::min() ); + VERIFY( x.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc new file mode 100644 index 000000000..47a76b613 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.6 class random_device [rand.device] + +#include + +void +test01() +{ + typedef std::random_device test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc new file mode 100644 index 000000000..f7352146d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [7] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::ranlux24 a; + a.discard(9999); + + VERIFY( a() == 9901578ul ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc new file mode 100644 index 000000000..65cf97560 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [5] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::ranlux24_base a; + a.discard(9999); + + VERIFY( a() == 7937952ul ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc new file mode 100644 index 000000000..095242c1c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [8] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::ranlux48 a; + a.discard(9999); + + VERIFY( a() == 249142670248501ull ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc new file mode 100644 index 000000000..42c423c73 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.5 Engines and egine adaptors with predefined parameters [rand.predef] +// 26.4.5 [6] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::ranlux48_base a; + a.discard(9999); + + VERIFY( a() == 61839128582725ull ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc new file mode 100644 index 000000000..c68c1b446 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.7.1 Class seed_seq [rand.util.seedseq] + +#include +#include + +void +test01() +{ + std::seed_seq seq; + + std::vector foo(10000); + seq.generate(foo.begin(), foo.end()); + + VERIFY( seq.size() == 0 ); + //VERIFY(); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc new file mode 100644 index 000000000..d98b6b2c4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-02-13 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.7.1 Class seed_seq [rand.util.seedseq] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::seed_seq seq({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); + + std::vector foo(10000); + seq.generate(foo.begin(), foo.end()); + + VERIFY( seq.size() == 10 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc new file mode 100644 index 000000000..69740c888 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.7.1 Class seed_seq [rand.util.seedseq] + +#include +#include + +void +test01() +{ + unsigned in[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + std::seed_seq seq(in, in + 10); + + std::vector foo(10000); + seq.generate(foo.begin(), foo.end()); + + VERIFY( seq.size() == 10 ); + //VERIFY(); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc new file mode 100644 index 000000000..6c92fa809 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.7.1 Class seed_seq [rand.util.seedseq] + +#include + +void +test01() +{ + typedef std::seed_seq test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc new file mode 100644 index 000000000..197f5f0de --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef std::linear_congruential_engine + base_engine; + + base_engine b; + + std::shuffle_order_engine e(b); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc new file mode 100644 index 000000000..c05bc1965 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef std::linear_congruential_engine + base_engine; + + std::shuffle_order_engine + e(std::move(base_engine())); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc new file mode 100644 index 000000000..55e38e22f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/copy.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > e(1); + + const auto f(e); + auto g(f); + g = g; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc new file mode 100644 index 000000000..15a5c2d8f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > e; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc new file mode 100644 index 000000000..b39d45a39 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + unsigned long seed = 2; + + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > e(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc new file mode 100644 index 000000000..c979e32b8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + double seed = 2.0; + + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > e(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc new file mode 100644 index 000000000..01ea91f1e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::seed_seq seq; + + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > e(seq); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc new file mode 100644 index 000000000..57763e851 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > u, v; + + VERIFY( u == v ); + + u.discard(100); + v.discard(100); + + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/inequal.cc new file mode 100644 index 000000000..43fc99fbb --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/inequal.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.4.1 class template discard_block_engine [rand.adapt.disc] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > u, v; + + VERIFY( !(u != v) ); + + u.discard(100); + v.discard(100); + + VERIFY( !(u != v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc new file mode 100644 index 000000000..578e49593 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.1 class template discard_block_engine [rand.adapt.disc] +// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::stringstream str; + std::shuffle_order_engine + < + std::linear_congruential_engine, + 256 + > u, v; + + u(); // advance + str << u; + + VERIFY( !(u == v) ); + + str >> v; + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc new file mode 100644 index 000000000..2a96488cd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constants.cc @@ -0,0 +1,39 @@ +// { dg-do link } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-09-29 Paolo Carlini +// +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ + std::knuth_b so; + + const void* p = &so.table_size; + p = &so.table_size; + p = p; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc new file mode 100644 index 000000000..dde00063e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_data.cc @@ -0,0 +1,60 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_data + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::table_size; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::shuffle_order_engine + < + std::linear_congruential_engine + < + uint_fast32_t,16807UL, 0UL, 2147483647UL + >, + 256 + > type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc new file mode 100644 index 000000000..8829898ff --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/constexpr_functions.cc @@ -0,0 +1,62 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::min(); + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::max(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::shuffle_order_engine + < + std::linear_congruential_engine + < + uint_fast32_t,16807UL, 0UL, 2147483647UL + >, + 256 + > type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc new file mode 100644 index 000000000..e2ec4ce14 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc @@ -0,0 +1,41 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.4.3 class template shuffle_order_engine [rand.adapt.shuf] +// 26.4.2.3 Concept RandomNumberEngineAdaptor [rand.concept.adapt] + +#include + +void +test01() +{ + typedef std::shuffle_order_engine + < + std::linear_congruential_engine + < + uint_fast32_t,16807UL, 0UL, 2147483647UL + >, + 256 + > test_type; + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc new file mode 100644 index 000000000..a875523d9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::student_t_distribution<> u; + VERIFY( u.n() == 1.0 ); + typedef std::student_t_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc new file mode 100644 index 000000000..19ea7bacd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::student_t_distribution<> u(1.5); + VERIFY( u.n() == 1.5 ); + typedef std::student_t_distribution<>::result_type result_type; + VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/equal.cc new file mode 100644 index 000000000..5117729b1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.6 Class template student_t_distribution [rand.dist.norm.t] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::student_t_distribution u(1.5), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/inequal.cc new file mode 100644 index 000000000..edead19d6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.4.6 Class template student_t_distribution [rand.dist.norm.t] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::student_t_distribution u(1.5), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc new file mode 100644 index 000000000..d4144702a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::student_t_distribution u(1.5), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..e090b3542 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::student_t_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc new file mode 100644 index 000000000..2639e87dd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/copy.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::subtract_with_carry_engine e(1); + + const auto f(e); + auto g(f); + g = g; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc new file mode 100644 index 000000000..1297747a5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::subtract_with_carry_engine x; + VERIFY( x.min() == 0 ); + VERIFY( x.max() == ((1UL << 24) - 1) ); + VERIFY( x() == 15039276 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc new file mode 100644 index 000000000..95db25f4d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.3 Class template subtract_with_carry_engine [rand.eng.sub] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include + +void +test01() +{ + unsigned long seed = 2; + std::subtract_with_carry_engine x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc new file mode 100644 index 000000000..73f9cbe0f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.3 Class template subtract_with_carry_engine [rand.eng.sub] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include + +void +test01() +{ + double seed = 2.0; + std::subtract_with_carry_engine x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq.cc new file mode 100644 index 000000000..3fc9991d7 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-02-01 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + std::seed_seq seed; + std::subtract_with_carry_engine x(seed); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc new file mode 100644 index 000000000..53fdbbefd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc @@ -0,0 +1,49 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.3 Class template subtract_with_carry_engine [rand.eng.sub] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::subtract_with_carry_engine u; + std::subtract_with_carry_engine v; + + VERIFY( u == v ); + + u.discard(100); + v.discard(100); + + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/inequal.cc new file mode 100644 index 000000000..aa7ec2420 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/inequal.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.3.3 Class template subtract_with_carry_engine [rand.eng.sub] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::subtract_with_carry_engine u; + std::subtract_with_carry_engine v; + + VERIFY( !(u != v) ); + + u.discard(100); + v.discard(100); + + VERIFY( !(u != v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc new file mode 100644 index 000000000..e4129fc8d --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.3 Class template subtract_with_carry_engine [rand.eng.sub] +// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::stringstream str; + std::subtract_with_carry_engine u; + std::subtract_with_carry_engine v; + + u(); // advance + str << u; + + VERIFY( !(u == v) ); + + str >> v; + VERIFY( u == v ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc new file mode 100644 index 000000000..8c033cd26 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constants.cc @@ -0,0 +1,41 @@ +// { dg-do link } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-09-29 Paolo Carlini +// +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ + std::ranlux24_base swc; + + const void* p = &swc.word_size; + p = &swc.short_lag; + p = &swc.long_lag; + p = &swc.default_seed; + p = p; // Suppress unused warning. +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc new file mode 100644 index 000000000..c22dae0bb --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_data.cc @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_data + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::word_size; + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::short_lag; + constexpr auto v3 __attribute__((unused)) + = _Ttesttype::long_lag; + constexpr auto v4 __attribute__((unused)) + = _Ttesttype::default_seed; + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_data test; + typedef std::ranlux24_base type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc new file mode 100644 index 000000000..39a3177ab --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/constexpr_functions.cc @@ -0,0 +1,55 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +namespace __gnu_test +{ + struct constexpr_member_functions + { + template + void + operator()() + { + struct _Concept + { + void __constraint() + { + constexpr auto v1 __attribute__((unused)) + = _Ttesttype::min(); + constexpr auto v2 __attribute__((unused)) + = _Ttesttype::max(); + } + }; + + _Concept c; + c.__constraint(); + } + }; +} + +int main() +{ + __gnu_test::constexpr_member_functions test; + typedef std::ranlux24_base type; + test.operator()(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc new file mode 100644 index 000000000..5e56a6e25 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.3.3 Class template subtract_with_carry_engine [rand.eng.sub] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::subtract_with_carry_engine + test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc new file mode 100644 index 000000000..dae94ccea --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist.uni.int] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_int_distribution u; + VERIFY( u.a() == 0 ); + VERIFY( u.b() == std::numeric_limits::max() ); + VERIFY( u.min() == 0 ); + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc new file mode 100644 index 000000000..70b40b0ad --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_int_distribution u(1, 20); + VERIFY( u.a() == 1 ); + VERIFY( u.b() == 20 ); + VERIFY( u.min() == 1 ); + VERIFY( u.max() == 20 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/equal.cc new file mode 100644 index 000000000..288cc0d66 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.1.1 Class template uniform_int_distribution [rand.dist_uni] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_int_distribution u(1, 20), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/inequal.cc new file mode 100644 index 000000000..48875c36a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.1.1 Class template uniform_int_distribution [rand.dist_uni] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_int_distribution u(1, 20), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc new file mode 100644 index 000000000..6ae080957 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::uniform_int_distribution u(1, 20), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..3d584b525 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::uniform_int_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc new file mode 100644 index 000000000..8240736c7 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.1 Class template uniform_real_distribution [rand.dist.uni.real] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_real_distribution u; + VERIFY( u.a() == 0.0 ); + VERIFY( u.b() == 1.0 ); + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == 1.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc new file mode 100644 index 000000000..ff1494b73 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.1 Class template uniform_real_distribution [rand.dist_uni] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_real_distribution u(-5.0, 5.0); + VERIFY( u.a() == -5.0 ); + VERIFY( u.b() == 5.0 ); + VERIFY( u.min() == -5.0 ); + VERIFY( u.max() == 5.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/equal.cc new file mode 100644 index 000000000..df27f6cf4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_real_distribution u(-5.0, 5.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/inequal.cc new file mode 100644 index 000000000..a93a4fde5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::uniform_real_distribution u(-5.0, 5.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc new file mode 100644 index 000000000..a6ef0f490 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::uniform_real_distribution u(-5.0, 5.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..c14182f72 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::uniform_real_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc new file mode 100644 index 000000000..1377c20e3 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::weibull_distribution<> u; + VERIFY( u.a() == 1.0 ); + VERIFY( u.b() == 1.0 ); + VERIFY( u.min() == 0.0 ); + typedef std::weibull_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc new file mode 100644 index 000000000..91eca51e5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::weibull_distribution<> u(2.0, 3.5); + VERIFY( u.a() == 2.0 ); + VERIFY( u.b() == 3.5 ); + VERIFY( u.min() == 0.0 ); + typedef std::weibull_distribution<>::result_type result_type; + VERIFY( u.max() == std::numeric_limits::max() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/equal.cc new file mode 100644 index 000000000..be4201a4f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/equal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::weibull_distribution u(2.0, 3.5), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/inequal.cc new file mode 100644 index 000000000..44dc1d3d1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/inequal.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.5.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::weibull_distribution u(2.0, 3.5), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc new file mode 100644 index 000000000..786702364 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include +#include + +void +test01() +{ + std::stringstream str; + std::weibull_distribution u(2.0, 3.5), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc new file mode 100644 index 000000000..5c8d8e076 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc @@ -0,0 +1,35 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull] +// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist] + +#include + +void +test01() +{ + typedef std::weibull_distribution test_type; + + typedef test_type::result_type result_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/slice/1.cc b/libstdc++-v3/testsuite/26_numerics/slice/1.cc new file mode 100644 index 000000000..1a911909c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/slice/1.cc @@ -0,0 +1,63 @@ +// 20020717 gdr + +// Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// Test slice class invariants + +#include +#include +#include + +bool +construction(std::size_t start, std::size_t size, std::size_t stride) +{ + std::slice s(start, size, stride); + return s.start() == start && s.size() == size && s.stride() == stride; +} + +bool +copy(std::size_t start, std::size_t size, std::size_t stride) +{ + std::slice s(start, size, stride); + std::slice t = s; + return t.start() == start && t.size() == size && t.stride() == stride; +} + +bool +assignment(std::size_t start, std::size_t size, std::size_t stride) +{ + std::slice s(start, size, stride); + std::slice t; + t = s; + return t.start() == start && t.size() == size && t.stride() == stride; +} + + +int main() +{ + bool test __attribute__((unused)) = true; + std::srand(20020717); + using std::rand; + VERIFY(construction(rand(), rand(), rand())); + + VERIFY(copy(rand(), rand(), rand())); + + VERIFY(assignment(rand(), rand(), rand())); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc new file mode 100644 index 000000000..0357e5de7 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc @@ -0,0 +1,40 @@ +// 20010613 gdr + +// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// This is DR-253. Test for accessible assignment-operators. +#include +#include + +int main() +{ + bool test __attribute__((unused)) = true; + using std::valarray; + using std::slice; + valarray v(1, 10), w(2, 10); + + w[slice(0, 3, 3)] = v[slice(2, 3, 3)]; + + VERIFY(v[0] == 1 && w[0] == 1); + VERIFY(v[3] == 1 && w[3] == 1); + VERIFY(v[6] == 1 && w[6] == 1); + + std::slice_array t __attribute__((unused)) = v[slice(0, 10, 1)]; + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..2e85f2ab1 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/explicit_instantiation.cc @@ -0,0 +1,25 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + + +// This file tests explicit instantiation of library containers. + +#include + +template class std::slice_array; diff --git a/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/typedefs.cc new file mode 100644 index 000000000..154fa01e6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/typedefs.cc @@ -0,0 +1,30 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// 6.2.2 Class template array + +#include + +void test01() +{ + // Check for required typedefs + typedef std::slice_array test_type; + typedef test_type::value_type value_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc b/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc new file mode 100644 index 000000000..4100aa7c4 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc @@ -0,0 +1,44 @@ +// Copyright (C) 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +// libstdc++/27867 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::valarray v1(100, 1); + std::valarray v2(100, 1); + std::valarray v3(true, 1); + + std::valarray resl(1); + resl = ((v1 == v2) == v3); + VERIFY( resl[0] == true ); + + std::valarray resr(1); + resr = (v3 == (v1 == v2)); + VERIFY( resr[0] == true ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc new file mode 100644 index 000000000..7e619c020 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc @@ -0,0 +1,43 @@ +// 2006-07-15 Paolo Carlini + +// Copyright (C) 2006, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// libstdc++/28277 +void test01() +{ + bool test __attribute__((unused)) = true; + + const std::valarray v1(1, 5000000); + + const std::valarray v2 = v1.shift(1); + VERIFY( v2.size() == v1.size() ); + VERIFY( v2[v1.size() - 1] == 0 ); + + const std::valarray v3 = v2.cshift(-1); + VERIFY( v3.size() == v2.size() ); + VERIFY( v3[0] == 0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc b/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc new file mode 100644 index 000000000..4ce8f75ed --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc @@ -0,0 +1,181 @@ +// 2007-01-11 Paolo Carlini + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include +#include + +bool +comp_vala(const std::valarray& v1, const std::valarray& v2) +{ + if (v1.size() == v2.size()) + { + for (size_t i = 0; i < v1.size(); ++i) + if (v1[i] != v2[i]) + return false; + return true; + } + return false; +} + +void +init_vala(std::valarray& v, size_t first, size_t last, int val) +{ + for (size_t i = first; i <= last; ++i) + v[i] = val++; +} + +// libstdc++/30416 +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + // shift + valarray v1; + valarray v1_ris(v1.shift(0)); + VERIFY( comp_vala(v1, v1_ris) ); + + valarray v2; + valarray v2_ris(v2.shift(10)); + VERIFY( comp_vala(v2, v2_ris) ); + + valarray v3; + valarray v3_ris(v3.shift(-10)); + VERIFY( comp_vala(v3, v3_ris) ); + + valarray v4(10); + valarray v4_ris(v4.shift(0)); + VERIFY( comp_vala(v4, v4_ris) ); + + valarray v5(10); + init_vala(v5, 0, 9, 1); + valarray v5_ref(10); + + valarray v5_ris(v5.shift(16)); + VERIFY( comp_vala(v5_ris, v5_ref) ); + + valarray v6(10); + init_vala(v6, 0, 9, 1); + valarray v6_ref(10); + + valarray v6_ris(v6.shift(-16)); + VERIFY( comp_vala(v6_ris, v6_ref) ); + + valarray v7(10); + init_vala(v7, 0, 9, 1); + valarray v7_ref(10); + + valarray v7_ris(v7.shift(10)); + VERIFY( comp_vala(v7_ris, v7_ref) ); + + valarray v8(10); + init_vala(v8, 0, 9, 1); + valarray v8_ref(10); + + valarray v8_ris(v8.shift(-10)); + VERIFY( comp_vala(v8_ris, v8_ref) ); + + valarray v9(10); + init_vala(v9, 0, 9, 1); + valarray v9_ref(10); + init_vala(v9_ref, 0, 3, 7); + + valarray v9_ris(v9.shift(6)); + VERIFY( comp_vala(v9_ris, v9_ref) ); + + valarray v10(10); + init_vala(v10, 0, 9, 1); + valarray v10_ref(10); + init_vala(v10_ref, 6, 9, 1); + + valarray v10_ris(v10.shift(-6)); + VERIFY( comp_vala(v10_ris, v10_ref) ); + + // cshift + valarray v11; + valarray v11_ris(v11.cshift(0)); + VERIFY( comp_vala(v11, v11_ris) ); + + valarray v12; + valarray v12_ris(v12.cshift(10)); + VERIFY( comp_vala(v12, v12_ris) ); + + valarray v13; + valarray v13_ris(v13.cshift(-10)); + VERIFY( comp_vala(v13, v13_ris) ); + + valarray v14(10); + valarray v14_ris(v14.cshift(0)); + VERIFY( comp_vala(v14, v14_ris) ); + + valarray v15(10); + init_vala(v15, 0, 9, 1); + valarray v15_ref(10); + init_vala(v15_ref, 0, 3, 7); + init_vala(v15_ref, 4, 9, 1); + + valarray v15_ris(v15.cshift(16)); + VERIFY( comp_vala(v15_ris, v15_ref) ); + + valarray v16(10); + init_vala(v16, 0, 9, 1); + valarray v16_ref(10); + init_vala(v16_ref, 0, 5, 5); + init_vala(v16_ref, 6, 9, 1); + + valarray v16_ris(v16.cshift(-16)); + VERIFY( comp_vala(v16_ris, v16_ref) ); + + valarray v17(10); + init_vala(v17, 0, 9, 1); + + valarray v17_ris(v15.cshift(10)); + VERIFY( comp_vala(v17, v17_ris) ); + + valarray v18(10); + init_vala(v18, 0, 9, 1); + + valarray v18_ris(v18.cshift(-10)); + VERIFY( comp_vala(v18, v18_ris) ); + + valarray v19(10); + init_vala(v19, 0, 9, 1); + valarray v19_ref(10); + init_vala(v19_ref, 0, 3, 7); + init_vala(v19_ref, 4, 9, 1); + + valarray v19_ris(v15.cshift(6)); + VERIFY( comp_vala(v19_ris, v19_ref) ); + + valarray v20(10); + init_vala(v20, 0, 9, 1); + valarray v20_ref(10); + init_vala(v20_ref, 0, 5, 5); + init_vala(v20_ref, 6, 9, 1); + + valarray v20_ris(v20.cshift(-6)); + VERIFY( comp_vala(v20_ris, v20_ref) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc b/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc new file mode 100644 index 000000000..918414197 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// { dg-do compile } + +#include + +// libstdc++/33084 +void test01() +{ + std::valarray vc(char(0), 10); + std::valarray res(10); + char c(0); + + res = vc == vc; + res = vc == c; + res = c == vc; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/40691.cc b/libstdc++-v3/testsuite/26_numerics/valarray/40691.cc new file mode 100644 index 000000000..5524835a6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/40691.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile } + +#include + +// PR libstdc++/40691 +void test01() +{ + const std::valarray vi(12); + std::valarray vb1(12); + std::valarray vb2(3); + std::slice s(0,3,4); + + vb1 = !vi; + vb2 = !(std::valarray)vi[s]; + vb2 = !vi[s]; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc b/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc new file mode 100644 index 000000000..c12497611 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc @@ -0,0 +1,31 @@ +// 19990404 gdr + +// Copyright (C) 1999, 2000, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include + +int main() +{ + // 02: algo + using std::valarray; + valarray b, c; + double m __attribute__((unused)) = std::abs(b - c).max(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc new file mode 100644 index 000000000..7dbcfbd52 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc @@ -0,0 +1,37 @@ +// 19990805 gdr +// +// XXX: to impove later. +// Origin: Andreas Amann +// CXXFLAGS: -g + +#include +#include + + +int main() +{ + std::valarray a(10), b(10), c(10), d(10); + + a = 1.2; + b = 3.1; + + c = 4.0; + + d = ( 2.0 * b + a ); // works + std::cout << "d[4] = " << d[4] << std::endl; + + d = (a * 2.0 + b ); // works + std::cout << "d[4] = " << d[4] << std::endl; + + d = (a + b * 2.0 ); // segfaults! + std::cout << "d[4] = " << d[4] << std::endl; + d = (a + 2.0* b ); + + std::cout << "d[4] = " << d[4] << std::endl; + d = (a + 2.0* b ); + std::cout << "d[4] = " << d[4] << std::endl; + d = (a + 2.0* b ); + + std::cout << "d[4] = " << d[4] << std::endl; + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc b/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc new file mode 100644 index 000000000..abd9cd873 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc @@ -0,0 +1,39 @@ +// 20010518 gdr + +// Copyright (C) 2001, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +#include + +// dg-do compile + +template + void copy(P, std::size_t) { } + +template + void test(const std::valarray& v) + { + copy(&v[0], v.size()); + } + +int main() +{ + std::valarray v(190); + test(v); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc b/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc new file mode 100644 index 000000000..e474ef998 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2006, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// DR 543. valarray slice default constructor +void test01() +{ + bool test __attribute__((unused)) = true; + + std::valarray v1(10); + std::valarray v2 = v1[std::slice()]; + VERIFY( v2.size() == 0 ); + + std::valarray v3(10); + std::valarray v4 = v3[std::gslice()]; + VERIFY( v4.size() == 0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/dr630-1.cc b/libstdc++-v3/testsuite/26_numerics/valarray/dr630-1.cc new file mode 100644 index 000000000..9e5d14a28 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/dr630-1.cc @@ -0,0 +1,60 @@ +// Copyright (C) 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// DR 630. +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + valarray v1; + const valarray v2(-1, 10000); + + v1 = v2; + VERIFY( v1.size() == v2.size() ); + VERIFY( (v1 == v2).min() == true ); + + valarray v3(0, 10000); + const valarray v4; + + v3 = v4; + VERIFY( v3.size() == v4.size() ); + VERIFY( v3.size() == 0 ); + + valarray v5(0, 100); + const valarray v6(-1, 10000); + + v5 = v6; + VERIFY( v5.size() == v6.size() ); + VERIFY( (v5 == v6).min() == true ); + + valarray v7(0, 10000); + const valarray v8(-1, 100); + + v7 = v8; + VERIFY( v7.size() == v8.size() ); + VERIFY( (v7 == v8).min() == true ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/dr630-2.cc b/libstdc++-v3/testsuite/26_numerics/valarray/dr630-2.cc new file mode 100644 index 000000000..ddb6bcaff --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/dr630-2.cc @@ -0,0 +1,67 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// DR 630. +void test01() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + valarray v1; + + v1 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + VERIFY( v1.size() == 10 ); + VERIFY( v1.min() == -1 ); + VERIFY( v1.max() == -1 ); + + valarray v2(0, 10); + + v2 = { }; + VERIFY( v2.size() == 0 ); + + valarray v3(0, 10); + + v3 = { -1, -1, -1, -1, -1 }; + VERIFY( v3.size() == 5 ); + VERIFY( v3.min() == -1 ); + VERIFY( v3.max() == -1 ); + + valarray v4(0, 5); + + v4 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + VERIFY( v4.size() == 10 ); + VERIFY( v4.min() == -1 ); + VERIFY( v4.max() == -1 ); + + valarray v5(0, 10); + + v5 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; + VERIFY( v5.size() == 10 ); + VERIFY( v5.min() == -1 ); + VERIFY( v5.max() == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc b/libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc new file mode 100644 index 000000000..1c0665901 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/init-list.cc @@ -0,0 +1,49 @@ +// Copyright (C) 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . +// + +// { dg-options "-std=gnu++0x" } + +#include +#include + +using namespace std; + +int test01() +{ + bool test __attribute__((unused)) = true; + + valarray m({ 1, 5, 37 }); + VERIFY(m.size() == 3); + VERIFY(m[0] == 1); + VERIFY(m[1] == 5); + VERIFY(m[2] == 37); + + m = { 28, 37, 102 }; + VERIFY(m.size() == 3); + VERIFY(m[0] == 28); + VERIFY(m[1] == 37); + VERIFY(m[2] == 102); + + return test; +} + +int main() +{ + __gnu_test::set_memory_limits(); + test01(); +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc b/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc new file mode 100644 index 000000000..65d679a21 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc @@ -0,0 +1,133 @@ +// 2002-08-02 gdr + +// Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// Test name lookup resolutions for standard functions applied to an +// array expression. +// { dg-do compile } + +#include + +namespace My +{ + struct Number + { + operator bool() const; + }; + + Number operator+(Number); + Number operator-(Number); + Number operator~(Number); + + bool operator!(Number); + + Number operator+(Number, Number); + Number operator-(Number, Number); + Number operator*(Number, Number); + Number operator/(Number, Number); + Number operator%(Number, Number); + + Number operator^(Number, Number); + Number operator&(Number, Number); + Number operator|(Number, Number); + + Number operator<<(Number, Number); + Number operator>>(Number, Number); + + bool operator==(Number, Number); + bool operator!=(Number, Number); + bool operator<(Number, Number); + bool operator<=(Number, Number); + bool operator>(Number, Number); + bool operator>=(Number, Number); + + Number abs(Number); + + Number cos(Number); + Number cosh(Number); + Number acos(Number); + + Number sin(Number); + Number sinh(Number); + Number asin(Number); + + Number tan(Number); + Number tanh(Number); + Number atan(Number); + + Number exp(Number); + Number log(Number); + Number log10(Number); + Number sqrt(Number); + + Number atan2(Number, Number); + Number pow(Number, Number); +} + +int main() +{ + typedef std::valarray Array; + Array u(10), v(10); + v = +u; + v = -u; + v = ~u; + std::valarray z = !u; + + v = abs(u); + + v = cos(u); + v = cosh(u); + v = acos(u); + + v = sin(u); + v = sinh(u); + v = asin(u); + + v = tan(u); + v = tanh(u); + v = atan(u); + + v = exp(u); + v = log(u); + v = log10(u); + v = sqrt(u); + + Array w = u + v; + w = u - v; + w = u * v; + w = u / v; + w = u % v; + + w = u ^ v; + w = u & v; + w = u | v; + + w = u << v; + w = u >> v; + + z = u == v; + z = u != v; + z = u < v; + z = u <= v; + z = u > v; + z = u >= v; + + w = atan2(u, v); + w = pow(u, v); +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc b/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc new file mode 100644 index 000000000..82904334a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc @@ -0,0 +1,68 @@ +// { dg-do run } +// 2003-02-03 Volker Reichelt + +// Copyright (C) 2003, 2009 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void test01() // check unary operators +{ + bool test __attribute__((unused)) = true; + std::valarray u(1); + u[0]=1; + + VERIFY( (+u)[0] == +1 ); + VERIFY( (-u)[0] == -1 ); + VERIFY( (!u)[0] == !1 ); + VERIFY( (~u)[0] == ~1 ); +} + +void test02() // check binary operators +{ + bool test __attribute__((unused)) = true; + std::valarray u(1), v(1); + u[0]=1; + v[0]=3; + + VERIFY( (u+ v)[0] == (1+ 3) ); + VERIFY( (u- v)[0] == (1- 3) ); + VERIFY( (u* v)[0] == (1* 3) ); + VERIFY( (u/ v)[0] == (1/ 3) ); + VERIFY( (u% v)[0] == (1% 3) ); + VERIFY( (u^ v)[0] == (1^ 3) ); + VERIFY( (u& v)[0] == (1& 3) ); + VERIFY( (u| v)[0] == (1| 3) ); + VERIFY( (u<>v)[0] == (1>>3) ); + VERIFY( (u&&v)[0] == (1&&3) ); + VERIFY( (u||v)[0] == (1||3) ); + VERIFY( (u==v)[0] == (1==3) ); + VERIFY( (u!=v)[0] == (1!=3) ); + VERIFY( (u< v)[0] == (1< 3) ); + VERIFY( (u> v)[0] == (1> 3) ); + VERIFY( (u<=v)[0] == (1<=3) ); + VERIFY( (u>=v)[0] == (1>=3) ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc b/libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc new file mode 100644 index 000000000..10f67dac8 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 26.6.10 valarray range access: [valarray.range] + +#include + +void +test01() +{ + std::valarray va{1.0, 2.0, 3.0}; + std::begin(va); + std::end(va); +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc new file mode 100644 index 000000000..d63ea7c75 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc @@ -0,0 +1,25 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING3. If not see +// . + + +// This file tests explicit instantiation of library containers. + +#include + +template class std::valarray; diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc new file mode 100644 index 000000000..6501d0738 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc @@ -0,0 +1,30 @@ +// { dg-do compile } + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// 6.2.2 Class template array + +#include + +void test01() +{ + // Check for required typedefs + typedef std::valarray test_type; + typedef test_type::value_type value_type; +} diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc b/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc new file mode 100644 index 000000000..00ec70b60 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc @@ -0,0 +1,78 @@ +// 2004-01-03 Jerry Quinn + +// Copyright (C) 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + + +// PR 3247 + +// This is DR-253. Test for accessible assignment-operators. +#include +#include + +bool check_array(std::valarray& a, double b[]) +{ + for (unsigned int i=0; i < a.size(); i++) + if (a[i] != b[i]) return false; + return true; +} + +int main() +{ + std::valarray val_d(10); // 0 1 2 3 4 5 6 7 8 9 + std::valarray val_d1(10); // 10 9 8 7 6 5 4 3 2 1 + + for (int i=0; i< 10; i++) { val_d[i] = 10; val_d1[i] = i; } + std::valarray val_c(val_d); + std::valarray val_f(val_d); + std::valarray val_g(val_d); + + std::slice slc(1, 3, 3); // 1 4 7 + val_d[slc] = val_d1[slc]; + + double ans1[10] = {10, 1, 10, 10, 4, 10, 10, 7, 10, 10}; + VERIFY(check_array(val_d, ans1)); + + std::valarray val_size(2); + std::valarray val_stride(2); + val_size[0] = 2; val_size[1] = 3; + val_stride[0] = 4; val_stride[1] = 1; + + std::gslice gslc(1, val_size, val_stride); + val_c[gslc] = val_d1[gslc]; + + double ans2[10] = {10, 1, 2, 3, 10, 5, 6, 7, 10, 10}; + VERIFY(check_array(val_c, ans2)); + + std::valarray val_b(false, 10); + val_b[2] = val_b[6] = val_b[9] = true; + val_f[val_b] = val_d1[val_b]; + + double ans3[10] = {10, 10, 2, 10, 10, 10, 6, 10, 10, 9}; + VERIFY(check_array(val_f, ans3)); + + size_t addr[] = {1, 2, 3, 4, 5}; + size_t addr1[] = {2, 7, 1, 9, 4}; + std::valarray val_indirect(addr, 5); + std::valarray val_indirect1(addr1, 5); + val_g[val_indirect] = val_d1[val_indirect1]; + + double ans4[10] = {10, 2, 7, 1, 9, 4, 10, 10, 10, 10}; + VERIFY(check_array(val_g, ans4)); + + return 0; +}; -- cgit v1.2.3