From bd4af2fe0f94167e4b2ef374fed40993b2911188 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Tue, 7 Oct 2025 13:05:48 -0400 Subject: [PATCH 1/4] use AGradRev so that all tests clean themselves up in the rev testing folder --- .../rev/core/accumulate_adjoints_test.cpp | 45 +++++----- .../math/rev/core/arena_allocator_test.cpp | 3 +- test/unit/math/rev/core/arena_matrix_test.cpp | 2 +- .../math/rev/core/build_vari_array_test.cpp | 3 +- .../unit/math/rev/core/callback_vari_test.cpp | 11 +-- .../math/rev/core/chainable_object_test.cpp | 17 ++-- test/unit/math/rev/core/count_vars_test.cpp | 46 ++++++----- .../math/rev/core/deep_copy_vars_test.cpp | 41 +++++----- test/unit/math/rev/core/grad_test.cpp | 9 +- test/unit/math/rev/core/gradable.hpp | 1 + .../rev/core/nested_rev_autodiff_test.cpp | 1 + .../rev/core/operator_logical_and_test.cpp | 3 +- .../rev/core/operator_logical_or_test.cpp | 3 +- .../rev/core/operator_unary_negative_test.cpp | 3 +- .../math/rev/core/operator_unary_not_test.cpp | 3 +- .../math/rev/core/precomp_vv_vari_test.cpp | 3 +- .../math/rev/core/precomp_vvv_vari_test.cpp | 3 +- .../rev/core/precomputed_gradients_test.cpp | 15 ++-- test/unit/math/rev/core/profiling_test.cpp | 11 +-- .../rev/core/profiling_threading_test.cpp | 3 +- .../rev/core/reverse_pass_callback_test.cpp | 3 +- test/unit/math/rev/core/save_varis_test.cpp | 45 +++++----- .../unit/math/rev/core/scalar_type_t_test.cpp | 3 +- .../rev/core/scoped_chainablestack_test.cpp | 1 + .../set_zero_all_adjoints_nested_test.cpp | 4 +- .../rev/core/std_iterator_traits_test.cpp | 3 +- .../rev/core/thread_stack_instance_test.cpp | 10 ++- test/unit/math/rev/core/var_stack_test.cpp | 9 +- test/unit/math/rev/core/vari_test.cpp | 22 ++--- .../unit/math/rev/core/zero_adjoints_test.cpp | 23 +++--- test/unit/math/rev/eigen_plugins_test.cpp | 7 +- test/unit/math/rev/err/check_bounded_test.cpp | 11 +-- .../rev/err/check_consistent_size_test.cpp | 7 +- .../rev/err/check_consistent_sizes_test.cpp | 5 +- test/unit/math/rev/err/check_finite_test.cpp | 7 +- .../rev/err/check_greater_or_equal_test.cpp | 13 +-- test/unit/math/rev/err/check_greater_test.cpp | 11 +-- .../math/rev/err/check_less_or_equal_test.cpp | 11 +-- test/unit/math/rev/err/check_less_test.cpp | 11 +-- .../math/rev/err/check_matching_dims_test.cpp | 5 +- .../math/rev/err/check_nonnegative_test.cpp | 9 +- .../math/rev/err/check_nonzero_size_test.cpp | 5 +- test/unit/math/rev/err/check_not_nan_test.cpp | 11 +-- .../math/rev/err/check_pos_definite_test.cpp | 3 +- .../rev/err/check_pos_semidefinite_test.cpp | 5 +- .../rev/err/check_positive_finite_test.cpp | 11 +-- .../unit/math/rev/err/check_positive_test.cpp | 9 +- .../math/rev/err/invalid_argument_test.cpp | 1 + .../rev/err/invalid_argument_vec_test.cpp | 1 + test/unit/math/rev/err/out_of_range_test.cpp | 1 + .../math/rev/err/throw_domain_error_test.cpp | 1 + .../rev/err/throw_domain_error_vec_test.cpp | 1 + test/unit/math/rev/fun/LDLT_factor_test.cpp | 7 +- test/unit/math/rev/fun/accumulator_test.cpp | 6 +- .../math/rev/fun/as_array_or_scalar_test.cpp | 7 +- test/unit/math/rev/fun/as_bool_test.cpp | 5 +- .../fun/as_column_vector_or_scalar_test.cpp | 5 +- .../rev/fun/as_value_array_or_scalar_test.cpp | 15 ++-- .../as_value_column_array_or_scalar_test.cpp | 17 ++-- .../as_value_column_vector_or_scalar_test.cpp | 17 ++-- test/unit/math/rev/fun/assign_test.cpp | 9 +- .../rev/fun/binomial_coefficient_log_test.cpp | 5 +- .../math/rev/fun/cholesky_decompose_test.cpp | 16 ++-- test/unit/math/rev/fun/cols_test.cpp | 7 +- test/unit/math/rev/fun/cov_exp_quad_test.cpp | 52 ++++++------ test/unit/math/rev/fun/dimensions_test.cpp | 23 +++--- .../math/rev/fun/eigenvalues_sym_test.cpp | 3 +- .../math/rev/fun/eigenvectors_sym_test.cpp | 3 +- test/unit/math/rev/fun/fill_test.cpp | 2 +- .../unit/math/rev/fun/from_var_value_test.cpp | 19 +++-- test/unit/math/rev/fun/get_lp_test.cpp | 6 +- .../math/rev/fun/gp_exp_quad_cov_test.cpp | 52 ++++++------ .../math/rev/fun/gp_periodic_cov_test.cpp | 82 +++++++++---------- test/unit/math/rev/fun/if_else_test.cpp | 8 +- .../math/rev/fun/initialize_fill_test.cpp | 9 +- test/unit/math/rev/fun/initialize_test.cpp | 5 +- .../math/rev/fun/initialize_variable_test.cpp | 3 +- test/unit/math/rev/fun/int_step_test.cpp | 3 +- test/unit/math/rev/fun/inv_inc_beta_test.cpp | 6 +- test/unit/math/rev/fun/is_any_nan_test.cpp | 6 +- test/unit/math/rev/fun/is_inf_test.cpp | 3 +- test/unit/math/rev/fun/is_nan_test.cpp | 3 +- .../math/rev/fun/is_uninitialized_test.cpp | 5 +- test/unit/math/rev/fun/jacobian.hpp | 1 + test/unit/math/rev/fun/lbeta_test.cpp | 5 +- test/unit/math/rev/fun/log_sum_exp_test.cpp | 6 +- test/unit/math/rev/fun/misc_test.cpp | 11 +-- .../math/rev/fun/primitive_value_test.cpp | 3 +- .../math/rev/fun/promote_elements_test.cpp | 7 +- .../unit/math/rev/fun/promote_scalar_test.cpp | 3 +- test/unit/math/rev/fun/read_var_test.cpp | 9 +- test/unit/math/rev/fun/rep_matrix_test.cpp | 10 +-- .../unit/math/rev/fun/rep_row_vector_test.cpp | 4 +- test/unit/math/rev/fun/rep_vector_test.cpp | 6 +- test/unit/math/rev/fun/rows_test.cpp | 7 +- .../math/rev/fun/scalar_seq_view_test.cpp | 13 +-- .../math/rev/fun/singular_values_test.cpp | 3 +- test/unit/math/rev/fun/size_mvt_test.cpp | 5 +- test/unit/math/rev/fun/sort_indices_test.cpp | 5 +- test/unit/math/rev/fun/stan_print_test.cpp | 3 +- .../rev/fun/stored_gradient_vari_test.cpp | 8 +- test/unit/math/rev/fun/to_arena_test.cpp | 11 +-- test/unit/math/rev/fun/to_var_test.cpp | 14 ++-- test/unit/math/rev/fun/to_var_value_test.cpp | 17 ++-- test/unit/math/rev/fun/to_vector_test.cpp | 3 +- test/unit/math/rev/fun/value_of_rec_test.cpp | 11 +-- test/unit/math/rev/fun/value_of_test.cpp | 15 ++-- .../math/rev/fun/vector_seq_view_test.cpp | 3 +- .../rev/functor/algebra_solver_fp_test.cpp | 1 + .../rev/functor/analytical_dae_typed_test.cpp | 1 + .../rev/functor/chem_dae_sens_typed_test.cpp | 1 + .../math/rev/functor/chem_dae_typed_test.cpp | 1 + .../math/rev/functor/cos_ode_typed_test.cpp | 1 + test/unit/math/rev/functor/coupled_mm.hpp | 2 + .../rev/functor/coupled_ode_system_test.cpp | 1 + .../math/rev/functor/cvodes_utils_test.cpp | 3 +- .../functor/degenerated_ode_typed_test.cpp | 1 + .../rev/functor/fho_ode_typed_ts_test.cpp | 1 + .../functor/finite_diff_hessian_auto_test.cpp | 13 +-- .../finite_diff_hessian_times_vector_test.cpp | 5 +- test/unit/math/rev/functor/gradient_test.cpp | 21 ++--- .../math/rev/functor/idas_system_test.cpp | 1 + .../rev/functor/index_3_dae_typed_test.cpp | 1 + .../rev/functor/integrate_1d_impl_test.cpp | 69 ++++++++-------- .../math/rev/functor/integrate_1d_test.cpp | 75 ++++++++--------- ..._ode_std_vector_interface_adapter_test.cpp | 7 +- .../rev/functor/linear_dae_typed_test.cpp | 1 + .../rev/functor/lorenz_ode_typed_fd_test.cpp | 1 + .../functor/map_rect_concurrent_prim_test.cpp | 1 + .../rev/functor/map_rect_concurrent_test.cpp | 1 + .../map_rect_concurrent_threads_test.cpp | 1 + .../rev/functor/map_rect_mpi_prim_test.cpp | 1 + .../math/rev/functor/map_rect_mpi_test.cpp | 1 + .../math/rev/functor/map_rect_prim_test.cpp | 1 + .../functor/ode_store_sensitivities_test.cpp | 5 +- .../math/rev/functor/ode_test_functors.hpp | 1 + .../functor/operands_and_partials_test.cpp | 19 +++-- .../rev/functor/partials_propagator_test.cpp | 19 +++-- .../math/rev/functor/pph_dae_typed_test.cpp | 1 + .../unit/math/rev/functor/reduce_sum_test.cpp | 19 +++-- .../sho_ode_adjoint_typed_error_test.cpp | 1 + .../rev/functor/sho_ode_typed_error_test.cpp | 1 + .../math/rev/functor/sho_ode_typed_test.cpp | 1 + .../math/rev/functor/solve_newton_test.cpp | 5 +- .../math/rev/functor/solve_powell_test.cpp | 5 +- .../functor/test_fixture_dae_analytical.hpp | 1 + .../rev/functor/test_fixture_dae_chem.hpp | 1 + .../rev/functor/test_fixture_dae_index_3.hpp | 1 + .../math/rev/functor/test_fixture_dae_pph.hpp | 1 + .../rev/functor/test_fixture_linear_dae.hpp | 1 + .../math/rev/functor/test_fixture_ode.hpp | 1 + .../functor/test_fixture_ode_cos_scalar.hpp | 1 + .../math/rev/functor/test_fixture_ode_fho.hpp | 1 + .../rev/functor/test_fixture_ode_lorenz.hpp | 1 + .../math/rev/functor/test_fixture_ode_sho.hpp | 1 + .../rev/functor/test_fixture_ode_sho_ctl.hpp | 1 + .../math/rev/functor/util_algebra_solver.hpp | 1 + .../rev/meta/VectorBuilderHelper_test.cpp | 11 +-- .../unit/math/rev/meta/VectorBuilder_test.cpp | 9 +- .../unit/math/rev/meta/ad_promotable_test.cpp | 5 +- .../rev/meta/conditional_var_value_test.cpp | 15 ++-- .../math/rev/meta/include_summand_test.cpp | 5 +- .../math/rev/meta/is_arena_matrix_test.cpp | 4 +- .../math/rev/meta/is_constant_all_test.cpp | 7 +- test/unit/math/rev/meta/is_fvar_test.cpp | 4 +- .../unit/math/rev/meta/is_rev_matrix_test.cpp | 10 ++- .../unit/math/rev/meta/is_var_matrix_test.cpp | 10 ++- .../rev/meta/is_var_or_arithmetic_test.cpp | 3 +- test/unit/math/rev/meta/is_var_test.cpp | 5 +- test/unit/math/rev/meta/is_vari_test.cpp | 3 +- test/unit/math/rev/meta/is_vector_test.cpp | 7 +- .../rev/meta/partials_return_type_test.cpp | 7 +- .../unit/math/rev/meta/partials_type_test.cpp | 3 +- .../rev/meta/promote_scalar_type_test.cpp | 3 +- .../math/rev/meta/promote_var_matrix_test.cpp | 3 +- .../math/rev/meta/require_generics_test.cpp | 39 ++++----- .../math/rev/meta/return_var_matrix_test.cpp | 3 +- .../math/rev/meta/rev_matrix_type_test.cpp | 3 +- .../prob/bernoulli_logit_glm_lpmf_test.cpp | 9 +- .../unit/math/rev/prob/binomial_lpmf_test.cpp | 17 ++-- test/unit/math/rev/prob/categorical2_test.cpp | 3 +- .../prob/categorical_logit_glm_lpmf_test.cpp | 4 +- test/unit/math/rev/prob/dirichlet2_test.cpp | 1 + test/unit/math/rev/prob/expect_eq_diffs.hpp | 1 + test/unit/math/rev/prob/inv_gamma_test.cpp | 3 +- test/unit/math/rev/prob/inv_wishart2_test.cpp | 2 +- .../rev/prob/inv_wishart_cholesky_test.cpp | 2 +- .../prob/lkj_corr_cholesky_test_functors.hpp | 1 + test/unit/math/rev/prob/lkj_corr_test.cpp | 6 +- test/unit/math/rev/prob/multi_gp2_test.cpp | 8 +- .../math/rev/prob/multi_gp_cholesky2_test.cpp | 8 +- .../unit/math/rev/prob/multi_normal2_test.cpp | 9 +- .../rev/prob/multi_normal_cholesky2_test.cpp | 5 +- .../rev/prob/multi_normal_cholesky_test.cpp | 4 +- .../math/rev/prob/multi_normal_prec2_test.cpp | 5 +- .../math/rev/prob/multi_normal_prec_test.cpp | 6 +- test/unit/math/rev/prob/multi_normal_test.cpp | 4 +- .../math/rev/prob/multi_student_t2_test.cpp | 10 +-- .../prob/multi_student_t_cholesky_test.cpp | 10 +-- .../math/rev/prob/multinomial_logit_test.cpp | 4 +- test/unit/math/rev/prob/multinomial_test.cpp | 4 +- .../rev/prob/neg_binomial_2_ccdf_log_test.cpp | 3 +- .../rev/prob/neg_binomial_2_cdf_log_test.cpp | 5 +- .../math/rev/prob/neg_binomial_2_cdf_test.cpp | 3 +- .../prob/neg_binomial_2_log_glm_lpmf_test.cpp | 2 +- .../math/rev/prob/neg_binomial_2_log_test.cpp | 9 +- .../math/rev/prob/neg_binomial_2_test.cpp | 9 +- .../rev/prob/neg_binomial_ccdf_log_test.cpp | 3 +- .../rev/prob/neg_binomial_cdf_log_test.cpp | 3 +- .../math/rev/prob/neg_binomial_cdf_test.cpp | 3 +- test/unit/math/rev/prob/neg_binomial_test.cpp | 3 +- .../math/rev/prob/normal_id_glm_lpdf_test.cpp | 10 +-- test/unit/math/rev/prob/normal_log_test.cpp | 3 +- .../prob/ordered_logistic_glm_lpmf_test.cpp | 2 +- .../math/rev/prob/ordered_logistic_test.cpp | 20 ++--- .../rev/prob/poisson_log_glm_lpmf_test.cpp | 8 +- test/unit/math/rev/prob/test_gradients.hpp | 1 + .../rev/prob/test_gradients_multi_normal.hpp | 1 + .../prob/test_gradients_multi_student_t.hpp | 1 + ...est_gradients_multi_student_t_cholesky.hpp | 1 + test/unit/math/rev/prob/weibull_test.cpp | 3 +- test/unit/math/rev/prob/wiener_full_test.cpp | 7 +- .../math/rev/prob/wishart_cholesky_test.cpp | 2 +- test/unit/math/rev/prob/wishart_test.cpp | 2 +- test/unit/math/rev/util.hpp | 1 + 225 files changed, 987 insertions(+), 792 deletions(-) diff --git a/test/unit/math/rev/core/accumulate_adjoints_test.cpp b/test/unit/math/rev/core/accumulate_adjoints_test.cpp index ba9252809d7..e8017993f73 100644 --- a/test/unit/math/rev/core/accumulate_adjoints_test.cpp +++ b/test/unit/math/rev/core/accumulate_adjoints_test.cpp @@ -1,9 +1,10 @@ #include #include #include +#include #include -TEST(AgradRev_accumulate_adjoints, zero_args) { +TEST_F(AgradRev, Rev_accumulate_adjoints_zero_args) { Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); double* ptr = stan::math::accumulate_adjoints(storage.data()); @@ -14,7 +15,7 @@ TEST(AgradRev_accumulate_adjoints, zero_args) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, int_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_int_arg) { int arg = 5; Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -27,7 +28,7 @@ TEST(AgradRev_accumulate_adjoints, int_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, double_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_double_arg) { double arg = 5.0; Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -40,7 +41,7 @@ TEST(AgradRev_accumulate_adjoints, double_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, std_vector_int_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_int_arg) { std::vector arg(5, 10); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -53,7 +54,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_int_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, std_vector_double_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_double_arg) { std::vector arg(5, 10.0); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -66,7 +67,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_double_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, eigen_vector_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_eigen_vector_arg) { Eigen::VectorXd arg = Eigen::VectorXd::Ones(5); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -78,7 +79,7 @@ TEST(AgradRev_accumulate_adjoints, eigen_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_eigen_row_vector_arg) { Eigen::RowVectorXd arg = Eigen::RowVectorXd::Ones(5); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -91,7 +92,7 @@ TEST(AgradRev_accumulate_adjoints, eigen_row_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, eigen_matrix_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_eigen_matrix_arg) { Eigen::MatrixXd arg = Eigen::MatrixXd::Ones(5, 5); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -104,7 +105,7 @@ TEST(AgradRev_accumulate_adjoints, eigen_matrix_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, std_vector_std_vector_double_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_std_vector_double_arg) { std::vector> arg(5, std::vector(5, 10.0)); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -117,7 +118,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_std_vector_double_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, std_vector_eigen_vector_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_eigen_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -130,7 +131,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_eigen_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, std_vector_eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_eigen_row_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -143,7 +144,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_eigen_row_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, std_vector_eigen_matrix_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_eigen_matrix_arg) { std::vector arg(2, Eigen::MatrixXd::Ones(5, 3)); Eigen::VectorXd storage = Eigen::VectorXd::Zero(1000); @@ -156,7 +157,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_eigen_matrix_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_accumulate_adjoints, var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_var_arg) { using stan::math::var; using stan::math::vari; var arg(5.0); @@ -178,7 +179,7 @@ TEST(AgradRev_accumulate_adjoints, var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, std_vector_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_var_arg) { using stan::math::var; using stan::math::vari; std::vector arg(5); @@ -203,7 +204,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_eigen_vector_var_arg) { using stan::math::var; using stan::math::vari; Eigen::Matrix arg(5); @@ -228,7 +229,7 @@ TEST(AgradRev_accumulate_adjoints, eigen_vector_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_eigen_row_vector_var_arg) { using stan::math::var; using stan::math::vari; Eigen::Matrix arg(5); @@ -253,7 +254,7 @@ TEST(AgradRev_accumulate_adjoints, eigen_row_vector_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_eigen_matrix_var_arg) { using stan::math::var; using stan::math::vari; Eigen::Matrix arg(5, 5); @@ -278,7 +279,7 @@ TEST(AgradRev_accumulate_adjoints, eigen_matrix_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, std_vector_std_vector_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_std_vector_var_arg) { using stan::math::var; using stan::math::vari; std::vector arg_(5, var(5.0)); @@ -302,7 +303,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_std_vector_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, std_vector_eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_eigen_vector_var_arg) { using stan::math::var; using stan::math::vari; Eigen::Matrix arg_(5); @@ -328,7 +329,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_eigen_vector_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, std_vector_eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_eigen_row_vector_var_arg) { using stan::math::var; using stan::math::vari; Eigen::Matrix arg_(5); @@ -354,7 +355,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_eigen_row_vector_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, std_vector_eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_accumulate_adjoints_std_vector_eigen_matrix_var_arg) { using stan::math::var; using stan::math::vari; Eigen::Matrix arg_(5, 3); @@ -380,7 +381,7 @@ TEST(AgradRev_accumulate_adjoints, std_vector_eigen_matrix_var_arg) { stan::math::recover_memory(); } -TEST(AgradRev_accumulate_adjoints, sum) { +TEST_F(AgradRev, Rev_accumulate_adjoints_sum) { using stan::math::var; using stan::math::vari; int arg1 = 1; diff --git a/test/unit/math/rev/core/arena_allocator_test.cpp b/test/unit/math/rev/core/arena_allocator_test.cpp index 0a6a30c7f0b..5de2fe2d928 100644 --- a/test/unit/math/rev/core/arena_allocator_test.cpp +++ b/test/unit/math/rev/core/arena_allocator_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -138,6 +139,6 @@ void arena_allocator_test() { } } -TEST(AgradRevArena, arena_allocator_test) { +TEST_F(AgradRev, RevArena_arena_allocator_test) { EXPECT_NO_THROW(arena_allocator_test()); } diff --git a/test/unit/math/rev/core/arena_matrix_test.cpp b/test/unit/math/rev/core/arena_matrix_test.cpp index f67650c1a84..fe866decc52 100644 --- a/test/unit/math/rev/core/arena_matrix_test.cpp +++ b/test/unit/math/rev/core/arena_matrix_test.cpp @@ -241,7 +241,7 @@ TEST_F(AgradRev, arena_sparse_matrix_inplace_ops) { expect_sparse_dense_matrix_equal(A_m, C); } -TEST(AgradRevArenaMat, arena_matrix_move_test) { +TEST_F(AgradRev, RevArenaMat_arena_matrix_move_test) { using stan::math::arena_matrix; Eigen::VectorXd c = Eigen::VectorXd::Random(3); Eigen::VectorXd d = c; diff --git a/test/unit/math/rev/core/build_vari_array_test.cpp b/test/unit/math/rev/core/build_vari_array_test.cpp index 072ebf00530..aca515b367a 100644 --- a/test/unit/math/rev/core/build_vari_array_test.cpp +++ b/test/unit/math/rev/core/build_vari_array_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevBuild, build_vari_array) { +TEST_F(AgradRev, RevBuild_build_vari_array) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/core/callback_vari_test.cpp b/test/unit/math/rev/core/callback_vari_test.cpp index 3bfcad264e0..eb9b4a7740a 100644 --- a/test/unit/math/rev/core/callback_vari_test.cpp +++ b/test/unit/math/rev/core/callback_vari_test.cpp @@ -1,8 +1,9 @@ #include #include #include +#include -TEST(AgradRevCBack, callback_vari_scalar_test) { +TEST_F(AgradRev, RevCBack_callback_vari_scalar_test) { stan::math::var a = 1; stan::math::var b = 1; @@ -20,7 +21,7 @@ TEST(AgradRevCBack, callback_vari_scalar_test) { EXPECT_EQ(b.adj(), 2); } -TEST(AgradRevCBack, callback_vari_const_scalar_compile_test) { +TEST_F(AgradRev, RevCBack_callback_vari_const_scalar_compile_test) { stan::math::var a = 1; const double& a_val = a.val(); @@ -30,7 +31,7 @@ TEST(AgradRevCBack, callback_vari_const_scalar_compile_test) { EXPECT_FLOAT_EQ(a.val(), b.val()); } -TEST(AgradRevCBack, callback_vari_eigen_test) { +TEST_F(AgradRev, RevCBack_callback_vari_eigen_test) { Eigen::MatrixXd val(2, 3); val << 1, 2, 3, 4, 5, 6; stan::math::var_value a = val; @@ -44,7 +45,7 @@ TEST(AgradRevCBack, callback_vari_eigen_test) { EXPECT_MATRIX_EQ(a.adj(), Eigen::MatrixXd::Constant(2, 3, 2)); } -TEST(AgradRevCBack, make_callback_var_scalar_test) { +TEST_F(AgradRev, RevCBack_make_callback_var_scalar_test) { stan::math::var a = 1; stan::math::var b = 1; @@ -63,7 +64,7 @@ TEST(AgradRevCBack, make_callback_var_scalar_test) { EXPECT_EQ(b.adj(), 2); } -TEST(AgradRevCBack, make_callback_var_eigen_test) { +TEST_F(AgradRev, RevCBack_make_callback_var_eigen_test) { Eigen::MatrixXd val(2, 3); val << 1, 2, 3, 4, 5, 6; stan::math::var_value a = val; diff --git a/test/unit/math/rev/core/chainable_object_test.cpp b/test/unit/math/rev/core/chainable_object_test.cpp index d668b330310..a5ec06840bc 100644 --- a/test/unit/math/rev/core/chainable_object_test.cpp +++ b/test/unit/math/rev/core/chainable_object_test.cpp @@ -1,6 +1,7 @@ #include #include #include +#include class ChainableObjectTest { public: @@ -11,7 +12,7 @@ class ChainableObjectTest { int ChainableObjectTest::counter = 0; -TEST(AgradRevChain, chainable_object_test) { +TEST_F(AgradRev, RevChain_chainable_object_test) { { EXPECT_NO_THROW(new stan::math::chainable_object( ChainableObjectTest())); @@ -23,7 +24,7 @@ TEST(AgradRevChain, chainable_object_test) { EXPECT_EQ((ChainableObjectTest::counter), 1); } -TEST(AgradRevChain, chainable_object_nested_test) { +TEST_F(AgradRev, RevChain_chainable_object_nested_test) { stan::math::start_nested(); { @@ -39,7 +40,7 @@ TEST(AgradRevChain, chainable_object_nested_test) { EXPECT_EQ((ChainableObjectTest::counter), 1); } -TEST(AgradRevChain, make_chainable_ptr_test) { +TEST_F(AgradRev, RevChain_make_chainable_ptr_test) { { EXPECT_NO_THROW(stan::math::make_chainable_ptr(ChainableObjectTest())); ChainableObjectTest::counter = 0; @@ -50,7 +51,7 @@ TEST(AgradRevChain, make_chainable_ptr_test) { EXPECT_EQ((ChainableObjectTest::counter), 1); } -TEST(AgradRevChain, make_chainable_ptr_nested_test) { +TEST_F(AgradRev, RevChain_make_chainable_ptr_nested_test) { stan::math::start_nested(); { @@ -74,7 +75,7 @@ class UnsafeChainableObjectTest { int UnsafeChainableObjectTest::counter = 0; -TEST(AgradRevChain, unsafe_chainable_object_test) { +TEST_F(AgradRev, RevChain_unsafe_chainable_object_test) { { EXPECT_NO_THROW( new stan::math::unsafe_chainable_object( @@ -87,7 +88,7 @@ TEST(AgradRevChain, unsafe_chainable_object_test) { EXPECT_EQ((UnsafeChainableObjectTest::counter), 1); } -TEST(AgradRevChain, unsafe_chainable_object_nested_test) { +TEST_F(AgradRev, RevChain_unsafe_chainable_object_nested_test) { stan::math::start_nested(); { @@ -103,7 +104,7 @@ TEST(AgradRevChain, unsafe_chainable_object_nested_test) { EXPECT_EQ((UnsafeChainableObjectTest::counter), 1); } -TEST(AgradRevChain, make_unsafe_chainable_ptr_test) { +TEST_F(AgradRev, RevChain_make_unsafe_chainable_ptr_test) { { EXPECT_NO_THROW( stan::math::make_unsafe_chainable_ptr(UnsafeChainableObjectTest())); @@ -115,7 +116,7 @@ TEST(AgradRevChain, make_unsafe_chainable_ptr_test) { EXPECT_EQ((UnsafeChainableObjectTest::counter), 1); } -TEST(AgradRevChain, make_unsafe_chainable_ptr_nested_test) { +TEST_F(AgradRev, RevChain_make_unsafe_chainable_ptr_nested_test) { stan::math::start_nested(); { diff --git a/test/unit/math/rev/core/count_vars_test.cpp b/test/unit/math/rev/core/count_vars_test.cpp index ec9a6b96e38..2ca9e616ffb 100644 --- a/test/unit/math/rev/core/count_vars_test.cpp +++ b/test/unit/math/rev/core/count_vars_test.cpp @@ -1,136 +1,138 @@ #include #include #include +#include + #include using stan::math::var; -TEST(AgradRev_count_vars, int_arg) { +TEST_F(AgradRev, Rev_count_vars_int_arg) { int arg = 5; EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, double_arg) { +TEST_F(AgradRev, Rev_count_vars_double_arg) { double arg = 5.0; EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_int_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_int_arg) { std::vector arg(5, 10); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_double_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_double_arg) { std::vector arg(5, 10.0); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, eigen_vector_arg) { +TEST_F(AgradRev, Rev_count_vars_eigen_vector_arg) { Eigen::VectorXd arg = Eigen::VectorXd::Ones(5); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_count_vars_eigen_row_vector_arg) { Eigen::RowVectorXd arg = Eigen::RowVectorXd::Ones(5); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, eigen_matrix_arg) { +TEST_F(AgradRev, Rev_count_vars_eigen_matrix_arg) { Eigen::MatrixXd arg = Eigen::MatrixXd::Ones(5, 5); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_std_vector_double_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_std_vector_double_arg) { std::vector> arg(5, std::vector(5, 10.0)); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_eigen_vector_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_row_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_eigen_matrix_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_matrix_arg) { std::vector arg(2, Eigen::MatrixXd::Ones(5, 3)); EXPECT_EQ(0, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, var_arg) { +TEST_F(AgradRev, Rev_count_vars_var_arg) { var arg = 5.0; EXPECT_EQ(1, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_var_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_var_arg) { std::vector arg(5); EXPECT_EQ(5, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_count_vars_eigen_vector_var_arg) { Eigen::Matrix arg(5); EXPECT_EQ(5, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_count_vars_eigen_row_vector_var_arg) { Eigen::Matrix arg(5); EXPECT_EQ(5, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_count_vars_eigen_matrix_var_arg) { Eigen::Matrix arg(5, 5); EXPECT_EQ(25, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_std_vector_var_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_std_vector_var_arg) { std::vector> arg(5, std::vector(5)); EXPECT_EQ(25, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_vector_var_arg) { std::vector> arg( 2, Eigen::Matrix(5)); EXPECT_EQ(10, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_row_vector_var_arg) { std::vector> arg( 2, Eigen::Matrix(5)); EXPECT_EQ(10, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, std_vector_eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_matrix_var_arg) { std::vector> arg( 2, Eigen::Matrix(5, 3)); EXPECT_EQ(30, stan::math::count_vars(arg)); } -TEST(AgradRev_count_vars, zero_args) { EXPECT_EQ(0, stan::math::count_vars()); } +TEST_F(AgradRev, Rev_count_vars_zero_args) { EXPECT_EQ(0, stan::math::count_vars()); } -TEST(AgradRev_count_vars, sum) { +TEST_F(AgradRev, Rev_count_vars_sum) { int arg1 = 1; double arg2 = 1.0; std::vector arg3(5, 1); diff --git a/test/unit/math/rev/core/deep_copy_vars_test.cpp b/test/unit/math/rev/core/deep_copy_vars_test.cpp index ac9e067a589..99f78c9fb9c 100644 --- a/test/unit/math/rev/core/deep_copy_vars_test.cpp +++ b/test/unit/math/rev/core/deep_copy_vars_test.cpp @@ -1,12 +1,13 @@ #include #include #include +#include #include using stan::math::var; using stan::math::vari; -TEST(AgradRev_deep_copy_vars, int_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_int_arg) { int arg = 5; decltype(stan::math::deep_copy_vars(arg)) out @@ -15,7 +16,7 @@ TEST(AgradRev_deep_copy_vars, int_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, double_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_double_arg) { double arg = 5.0; decltype(stan::math::deep_copy_vars(arg)) out @@ -24,7 +25,7 @@ TEST(AgradRev_deep_copy_vars, double_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, std_vector_int_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_int_arg) { std::vector arg(5, 10); decltype(stan::math::deep_copy_vars(arg)) out @@ -33,7 +34,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_int_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, std_vector_double_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_double_arg) { std::vector arg(5, 10.0); decltype(stan::math::deep_copy_vars(arg)) out @@ -42,7 +43,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_double_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, eigen_vector_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_eigen_vector_arg) { Eigen::VectorXd arg = Eigen::VectorXd::Ones(5); decltype(stan::math::deep_copy_vars(arg)) out @@ -51,7 +52,7 @@ TEST(AgradRev_deep_copy_vars, eigen_vector_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_eigen_row_vector_arg) { Eigen::RowVectorXd arg = Eigen::RowVectorXd::Ones(5); decltype(stan::math::deep_copy_vars(arg)) out @@ -60,7 +61,7 @@ TEST(AgradRev_deep_copy_vars, eigen_row_vector_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, eigen_matrix_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_eigen_matrix_arg) { Eigen::MatrixXd arg = Eigen::MatrixXd::Ones(5, 5); decltype(stan::math::deep_copy_vars(arg)) out @@ -69,7 +70,7 @@ TEST(AgradRev_deep_copy_vars, eigen_matrix_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, std_vector_std_vector_double_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_std_vector_double_arg) { std::vector> arg(5, std::vector(5, 10.0)); decltype(stan::math::deep_copy_vars(arg)) out @@ -78,7 +79,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_std_vector_double_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, std_vector_eigen_vector_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_eigen_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); decltype(stan::math::deep_copy_vars(arg)) out @@ -87,7 +88,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_eigen_vector_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, std_vector_eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_eigen_row_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); decltype(stan::math::deep_copy_vars(arg)) out @@ -96,7 +97,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_eigen_row_vector_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, std_vector_eigen_matrix_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_eigen_matrix_arg) { std::vector arg(2, Eigen::MatrixXd::Ones(5, 3)); decltype(stan::math::deep_copy_vars(arg)) out @@ -105,7 +106,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_eigen_matrix_arg) { EXPECT_EQ(&out, &arg); } -TEST(AgradRev_deep_copy_vars, var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_var_arg) { var arg(5.0); arg.vi_->adj_ = 2.0; @@ -120,7 +121,7 @@ TEST(AgradRev_deep_copy_vars, var_arg) { EXPECT_NE(out.vi_, arg.vi_); } -TEST(AgradRev_deep_copy_vars, std_vector_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_var_arg) { std::vector arg(5); for (size_t i = 0; i < arg.size(); ++i) arg[i] = i + 1.0; @@ -141,7 +142,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_var_arg) { } } -TEST(AgradRev_deep_copy_vars, eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_eigen_vector_var_arg) { Eigen::Matrix arg(5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = i + 1.0; @@ -164,7 +165,7 @@ TEST(AgradRev_deep_copy_vars, eigen_vector_var_arg) { } } -TEST(AgradRev_deep_copy_vars, eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_eigen_row_vector_var_arg) { Eigen::Matrix arg(5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = i + 1.0; @@ -187,7 +188,7 @@ TEST(AgradRev_deep_copy_vars, eigen_row_vector_var_arg) { } } -TEST(AgradRev_deep_copy_vars, eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_eigen_matrix_var_arg) { Eigen::Matrix arg(5, 5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = i + 1.0; @@ -210,7 +211,7 @@ TEST(AgradRev_deep_copy_vars, eigen_matrix_var_arg) { } } -TEST(AgradRev_deep_copy_vars, std_vector_std_vector_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_std_vector_var_arg) { std::vector arg_(5); std::vector> arg(5, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -234,7 +235,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_std_vector_var_arg) { } } -TEST(AgradRev_deep_copy_vars, std_vector_eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_eigen_vector_var_arg) { Eigen::Matrix arg_(5); std::vector> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -258,7 +259,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_eigen_vector_var_arg) { } } -TEST(AgradRev_deep_copy_vars, std_vector_eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_eigen_row_vector_var_arg) { Eigen::Matrix arg_(5); std::vector> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -282,7 +283,7 @@ TEST(AgradRev_deep_copy_vars, std_vector_eigen_row_vector_var_arg) { } } -TEST(AgradRev_deep_copy_vars, std_vector_eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_deep_copy_vars_std_vector_eigen_matrix_var_arg) { Eigen::Matrix arg_(5, 3); std::vector> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) diff --git a/test/unit/math/rev/core/grad_test.cpp b/test/unit/math/rev/core/grad_test.cpp index b3fdaa1bcc8..7222c1ef419 100644 --- a/test/unit/math/rev/core/grad_test.cpp +++ b/test/unit/math/rev/core/grad_test.cpp @@ -1,10 +1,11 @@ #include -#include #include +#include +#include #include #include -TEST(AgradRev, multiple_grads) { +TEST_F(AgradRev, Rev_multiple_grads) { for (int i = 0; i < 100; ++i) { stan::math::var a = 2.0; stan::math::var b = 3.0 * a; @@ -30,7 +31,7 @@ TEST(AgradRev, multiple_grads) { EXPECT_FLOAT_EQ(2.0, grad_f[1]); } -TEST(AgradRev, ensure_first_vari_chained) { +TEST_F(AgradRev, Rev_ensure_first_vari_chained) { using stan::math::var; // Make sure there aren't any varis on stack @@ -78,7 +79,7 @@ class test_vari : public vari { } // namespace math } // namespace stan -TEST(AgradRev, nested_grad_during_chain) { +TEST_F(AgradRev, Rev_nested_grad_during_chain) { using stan::math::var; var total = 0.0; diff --git a/test/unit/math/rev/core/gradable.hpp b/test/unit/math/rev/core/gradable.hpp index b27f3d4fdb7..a4c198d1ed6 100644 --- a/test/unit/math/rev/core/gradable.hpp +++ b/test/unit/math/rev/core/gradable.hpp @@ -2,6 +2,7 @@ #define TEST_UNIT_MATH_REV_CORE_GRADABLE_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/core/nested_rev_autodiff_test.cpp b/test/unit/math/rev/core/nested_rev_autodiff_test.cpp index 2c2d667f5b5..133f515e4dc 100644 --- a/test/unit/math/rev/core/nested_rev_autodiff_test.cpp +++ b/test/unit/math/rev/core/nested_rev_autodiff_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include diff --git a/test/unit/math/rev/core/operator_logical_and_test.cpp b/test/unit/math/rev/core/operator_logical_and_test.cpp index 47306748d88..5af61948801 100644 --- a/test/unit/math/rev/core/operator_logical_and_test.cpp +++ b/test/unit/math/rev/core/operator_logical_and_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -10,7 +11,7 @@ void test_logical_and(double x, double y) { EXPECT_EQ(x && y, var(x) && y); } -TEST(AgradRev, logical_and) { +TEST_F(AgradRev, Rev_logical_and) { std::vector xs; xs.push_back(6.1); xs.push_back(6.1); diff --git a/test/unit/math/rev/core/operator_logical_or_test.cpp b/test/unit/math/rev/core/operator_logical_or_test.cpp index f1a957b9561..3bf9d01f011 100644 --- a/test/unit/math/rev/core/operator_logical_or_test.cpp +++ b/test/unit/math/rev/core/operator_logical_or_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -10,7 +11,7 @@ void test_logical_or(double x, double y) { EXPECT_EQ(x || y, x_v || y_v); } -TEST(AgradRev, logical_or) { +TEST_F(AgradRev, Rev_logical_or) { std::vector xs; xs.push_back(6.1); xs.push_back(6.1); diff --git a/test/unit/math/rev/core/operator_unary_negative_test.cpp b/test/unit/math/rev/core/operator_unary_negative_test.cpp index 705e15ad91f..23a0f31ae1d 100644 --- a/test/unit/math/rev/core/operator_unary_negative_test.cpp +++ b/test/unit/math/rev/core/operator_unary_negative_test.cpp @@ -1,10 +1,11 @@ #include #include #include +#include #include #include -TEST(AgradRev, varmat_unary_negative) { +TEST_F(AgradRev, Rev_varmat_unary_negative) { stan::math::var_value x = Eigen::MatrixXd::Random(2, 3); stan::math::var_value y = -x; diff --git a/test/unit/math/rev/core/operator_unary_not_test.cpp b/test/unit/math/rev/core/operator_unary_not_test.cpp index 55169e3d3dd..dd3a68a11a9 100644 --- a/test/unit/math/rev/core/operator_unary_not_test.cpp +++ b/test/unit/math/rev/core/operator_unary_not_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -8,7 +9,7 @@ void test_unary_not(double x) { EXPECT_EQ(!x, !x_v); } -TEST(AgradRev, unaryNot) { +TEST_F(AgradRev, Rev_unaryNot) { test_unary_not(6.1); test_unary_not(0); test_unary_not(-13.2); diff --git a/test/unit/math/rev/core/precomp_vv_vari_test.cpp b/test/unit/math/rev/core/precomp_vv_vari_test.cpp index 0ac5c669126..6af78e9fbe7 100644 --- a/test/unit/math/rev/core/precomp_vv_vari_test.cpp +++ b/test/unit/math/rev/core/precomp_vv_vari_test.cpp @@ -1,8 +1,9 @@ #include #include +#include #include -TEST(StanAgradRevInternal, precomp_vv_vari) { +TEST_F(AgradRev, StanAgradRevInternal_precomp_vv_vari) { double value, gradient1, gradient2; stan::math::var x1(2), x2(3); stan::math::var y; diff --git a/test/unit/math/rev/core/precomp_vvv_vari_test.cpp b/test/unit/math/rev/core/precomp_vvv_vari_test.cpp index 2e47885a75e..de256c81810 100644 --- a/test/unit/math/rev/core/precomp_vvv_vari_test.cpp +++ b/test/unit/math/rev/core/precomp_vvv_vari_test.cpp @@ -1,8 +1,9 @@ #include #include +#include #include -TEST(StanAgradRevInternal, precomp_vvv_vari) { +TEST_F(AgradRev, StanAgradRevInternal_precomp_vvv_vari) { double value, gradient1, gradient2, gradient3; stan::math::var x1(2), x2(3), x3(5); stan::math::var y; diff --git a/test/unit/math/rev/core/precomputed_gradients_test.cpp b/test/unit/math/rev/core/precomputed_gradients_test.cpp index 4bc34d853d1..fc03a242ee4 100644 --- a/test/unit/math/rev/core/precomputed_gradients_test.cpp +++ b/test/unit/math/rev/core/precomputed_gradients_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(StanAgradRevInternal, precomputed_gradients) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients) { double value; std::vector vars; std::vector gradients; @@ -31,7 +32,7 @@ TEST(StanAgradRevInternal, precomputed_gradients) { stan::math::recover_memory(); } -TEST(StanAgradRevInternal, precomputed_gradients_vari_no_independent_vars) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_vari_no_independent_vars) { double value = 1; std::vector vars; std::vector gradients; @@ -42,7 +43,7 @@ TEST(StanAgradRevInternal, precomputed_gradients_vari_no_independent_vars) { EXPECT_NO_THROW(vi.chain()); } -TEST(StanAgradRevInternal, precomputed_gradients_vari_mismatched_sizes) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_vari_mismatched_sizes) { double value; std::vector vars; std::vector gradients; @@ -54,7 +55,7 @@ TEST(StanAgradRevInternal, precomputed_gradients_vari_mismatched_sizes) { std::invalid_argument); } -TEST(StanAgradRevInternal, precomputed_gradients_vari) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_vari) { double value = 1; std::vector vars; stan::math::var x1(2), x2(3); @@ -85,7 +86,7 @@ TEST(StanAgradRevInternal, precomputed_gradients_vari) { EXPECT_FLOAT_EQ(gradients[1], x2.vi_->adj_); } -TEST(StanAgradRevInternal, precomputed_gradients_mismatched_sizes) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_mismatched_sizes) { double value; std::vector vars; std::vector gradients; @@ -102,7 +103,7 @@ TEST(StanAgradRevInternal, precomputed_gradients_mismatched_sizes) { stan::math::recover_memory(); } -TEST(StanAgradRevInternal, precomputed_gradients_containers) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_containers) { double value = 1; std::vector vars; std::vector gradients; @@ -160,7 +161,7 @@ TEST(StanAgradRevInternal, stan::math::recover_memory(); } -TEST(StanAgradRevInternal, precomputed_gradients_mismatched_containers) { +TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_mismatched_containers) { double value = 1; std::vector vars; std::vector gradients; diff --git a/test/unit/math/rev/core/profiling_test.cpp b/test/unit/math/rev/core/profiling_test.cpp index a8d2ed4fe7c..32bfe57e4fe 100644 --- a/test/unit/math/rev/core/profiling_test.cpp +++ b/test/unit/math/rev/core/profiling_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(Profiling, double_basic) { +TEST_F(AgradRev, Profiling_double_basic) { using stan::math::profile; using stan::math::var; stan::math::profile_map prof_map; @@ -33,7 +34,7 @@ TEST(Profiling, double_basic) { EXPECT_TRUE(prof_map[key].get_fwd_time() > 0.0); } -TEST(Profiling, var_basic) { +TEST_F(AgradRev, Profiling_var_basic) { using stan::math::profile; using stan::math::var; stan::math::profile_map profiles; @@ -59,7 +60,7 @@ TEST(Profiling, var_basic) { EXPECT_TRUE(profiles[key].get_rev_time() > 0.0); } -TEST(Profiling, var_exception) { +TEST_F(AgradRev, Profiling_var_exception) { using stan::math::profile; using stan::math::var; stan::math::profile_map profiles; @@ -89,7 +90,7 @@ TEST(Profiling, var_exception) { EXPECT_TRUE(profiles[key_t1].get_rev_time() == 0.0); } -TEST(Profiling, var_loop) { +TEST_F(AgradRev, Profiling_var_loop) { using stan::math::profile; using stan::math::var; stan::math::profile_map profiles; @@ -117,7 +118,7 @@ TEST(Profiling, var_loop) { EXPECT_TRUE(profiles[key_t1].get_rev_time() > 0.0); } -TEST(Profiling, duplicate_active_profile) { +TEST_F(AgradRev, Profiling_duplicate_active_profile) { using stan::math::profile; using stan::math::var; stan::math::profile_map profiles; diff --git a/test/unit/math/rev/core/profiling_threading_test.cpp b/test/unit/math/rev/core/profiling_threading_test.cpp index e139a735264..b3c2c78fa2b 100644 --- a/test/unit/math/rev/core/profiling_threading_test.cpp +++ b/test/unit/math/rev/core/profiling_threading_test.cpp @@ -1,5 +1,6 @@ #ifdef STAN_THREADS #include +#include #include #include #include @@ -26,7 +27,7 @@ struct grouped_count_lpdf { }; } // namespace profiling_test -TEST(Profiling, profile_threading) { +TEST_F(AgradRev, Profiling_profile_threading) { using stan::math::var; using stan::math::test::get_new_msg; double lambda_d = 10.0; diff --git a/test/unit/math/rev/core/reverse_pass_callback_test.cpp b/test/unit/math/rev/core/reverse_pass_callback_test.cpp index cdb7f200fe1..a91317d7f2c 100644 --- a/test/unit/math/rev/core/reverse_pass_callback_test.cpp +++ b/test/unit/math/rev/core/reverse_pass_callback_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(AgradRev, reverse_pass_callback_test) { +TEST_F(AgradRev, Rev_reverse_pass_callback_test) { stan::math::var a = 1; stan::math::var b = 1; diff --git a/test/unit/math/rev/core/save_varis_test.cpp b/test/unit/math/rev/core/save_varis_test.cpp index 1d737f94562..5f8a69ce0d9 100644 --- a/test/unit/math/rev/core/save_varis_test.cpp +++ b/test/unit/math/rev/core/save_varis_test.cpp @@ -1,11 +1,12 @@ #include +#include #include #include using stan::math::var; using stan::math::vari; -TEST(AgradRev_save_varis, zero_args) { +TEST_F(AgradRev, Rev_save_varis_zero_args) { std::vector storage(1000, nullptr); vari** ptr = stan::math::save_varis(storage.data()); @@ -16,7 +17,7 @@ TEST(AgradRev_save_varis, zero_args) { stan::math::recover_memory(); } -TEST(AgradRev_save_varis, int_arg) { +TEST_F(AgradRev, Rev_save_varis_int_arg) { int arg = 5; std::vector storage(1000, nullptr); @@ -29,7 +30,7 @@ TEST(AgradRev_save_varis, int_arg) { stan::math::recover_memory(); } -TEST(AgradRev_save_varis, double_arg) { +TEST_F(AgradRev, Rev_save_varis_double_arg) { double arg = 5.0; std::vector storage(1000, nullptr); @@ -41,7 +42,7 @@ TEST(AgradRev_save_varis, double_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, std_vector_int_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_int_arg) { std::vector arg(5, 10); std::vector storage(1000, nullptr); @@ -53,7 +54,7 @@ TEST(AgradRev_save_varis, std_vector_int_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, std_vector_double_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_double_arg) { std::vector arg(5, 10.0); std::vector storage(1000, nullptr); @@ -65,7 +66,7 @@ TEST(AgradRev_save_varis, std_vector_double_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, eigen_vector_arg) { +TEST_F(AgradRev, Rev_save_varis_eigen_vector_arg) { Eigen::VectorXd arg = Eigen::VectorXd::Ones(5); std::vector storage(1000, nullptr); @@ -77,7 +78,7 @@ TEST(AgradRev_save_varis, eigen_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_save_varis_eigen_row_vector_arg) { Eigen::RowVectorXd arg = Eigen::RowVectorXd::Ones(5); std::vector storage(1000, nullptr); @@ -89,7 +90,7 @@ TEST(AgradRev_save_varis, eigen_row_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, eigen_matrix_arg) { +TEST_F(AgradRev, Rev_save_varis_eigen_matrix_arg) { Eigen::MatrixXd arg = Eigen::MatrixXd::Ones(5, 5); std::vector storage(1000, nullptr); @@ -101,7 +102,7 @@ TEST(AgradRev_save_varis, eigen_matrix_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, std_vector_std_vector_double_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_std_vector_double_arg) { std::vector> arg(5, std::vector(5, 10.0)); std::vector storage(1000, nullptr); @@ -113,7 +114,7 @@ TEST(AgradRev_save_varis, std_vector_std_vector_double_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, std_vector_eigen_vector_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_eigen_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); std::vector storage(1000, nullptr); @@ -125,7 +126,7 @@ TEST(AgradRev_save_varis, std_vector_eigen_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, std_vector_eigen_row_vector_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_eigen_row_vector_arg) { std::vector arg(2, Eigen::VectorXd::Ones(5)); std::vector storage(1000, nullptr); @@ -137,7 +138,7 @@ TEST(AgradRev_save_varis, std_vector_eigen_row_vector_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, std_vector_eigen_matrix_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_eigen_matrix_arg) { std::vector arg(2, Eigen::MatrixXd::Ones(5, 3)); std::vector storage(1000, nullptr); @@ -149,7 +150,7 @@ TEST(AgradRev_save_varis, std_vector_eigen_matrix_arg) { EXPECT_EQ(ptr, storage.data()); } -TEST(AgradRev_save_varis, var_arg) { +TEST_F(AgradRev, Rev_save_varis_var_arg) { var arg(5.0); std::vector storage(1000, nullptr); @@ -165,7 +166,7 @@ TEST(AgradRev_save_varis, var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, std_vector_var_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_var_arg) { std::vector arg(5); for (size_t i = 0; i < arg.size(); ++i) arg[i] = 5.0; @@ -183,7 +184,7 @@ TEST(AgradRev_save_varis, std_vector_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_save_varis_eigen_vector_var_arg) { Eigen::Matrix arg(5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = 5.0; @@ -203,7 +204,7 @@ TEST(AgradRev_save_varis, eigen_vector_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_save_varis_eigen_row_vector_var_arg) { Eigen::Matrix arg(5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = 5.0; @@ -223,7 +224,7 @@ TEST(AgradRev_save_varis, eigen_row_vector_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_save_varis_eigen_matrix_var_arg) { Eigen::Matrix arg(5, 5); for (size_t i = 0; i < arg.size(); ++i) { arg(i) = 5.0; @@ -243,7 +244,7 @@ TEST(AgradRev_save_varis, eigen_matrix_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, std_vector_std_vector_var_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_std_vector_var_arg) { std::vector arg_(5); std::vector> arg(5, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -265,7 +266,7 @@ TEST(AgradRev_save_varis, std_vector_std_vector_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, std_vector_eigen_vector_var_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_eigen_vector_var_arg) { Eigen::Matrix arg_(5); std::vector> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -287,7 +288,7 @@ TEST(AgradRev_save_varis, std_vector_eigen_vector_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, std_vector_eigen_row_vector_var_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_eigen_row_vector_var_arg) { Eigen::Matrix arg_(5); std::vector> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -309,7 +310,7 @@ TEST(AgradRev_save_varis, std_vector_eigen_row_vector_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, std_vector_eigen_matrix_var_arg) { +TEST_F(AgradRev, Rev_save_varis_std_vector_eigen_matrix_var_arg) { Eigen::Matrix arg_(5, 3); std::vector> arg(2, arg_); for (size_t i = 0; i < arg.size(); ++i) @@ -331,7 +332,7 @@ TEST(AgradRev_save_varis, std_vector_eigen_matrix_var_arg) { EXPECT_EQ(ptr, storage.data() + num_vars); } -TEST(AgradRev_save_varis, sum) { +TEST_F(AgradRev, Rev_save_varis_sum) { int arg1 = 1; double arg2 = 1.0; std::vector arg3(5, 1); diff --git a/test/unit/math/rev/core/scalar_type_t_test.cpp b/test/unit/math/rev/core/scalar_type_t_test.cpp index 607505acb7d..ac105d0865d 100644 --- a/test/unit/math/rev/core/scalar_type_t_test.cpp +++ b/test/unit/math/rev/core/scalar_type_t_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevScalar, scalar_type_t_var_value) { +TEST_F(AgradRev, RevScalar_scalar_type_t_var_value) { EXPECT_TRUE( (std::is_same< stan::math::var, diff --git a/test/unit/math/rev/core/scoped_chainablestack_test.cpp b/test/unit/math/rev/core/scoped_chainablestack_test.cpp index 263d64f8eb1..c62a8d2d4ae 100644 --- a/test/unit/math/rev/core/scoped_chainablestack_test.cpp +++ b/test/unit/math/rev/core/scoped_chainablestack_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/test/unit/math/rev/core/set_zero_all_adjoints_nested_test.cpp b/test/unit/math/rev/core/set_zero_all_adjoints_nested_test.cpp index d516325ef1d..4070dbe11e1 100644 --- a/test/unit/math/rev/core/set_zero_all_adjoints_nested_test.cpp +++ b/test/unit/math/rev/core/set_zero_all_adjoints_nested_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevZeroNested, set_zero_all_adjoints_nested_outside) { +TEST_F(AgradRev, RevZeroNested_set_zero_all_adjoints_nested_outside) { stan::math::var chaining = new stan::math::vari(1.0, true); chaining.adj() = 2.0; @@ -20,4 +21,5 @@ TEST(AgradRevZeroNested, set_zero_all_adjoints_nested_outside) { EXPECT_FLOAT_EQ(non_chaining.adj(), 2.0); stan::math::set_zero_all_adjoints_nested(); EXPECT_FLOAT_EQ(non_chaining.adj(), 2.0); + stan::math::recover_memory_nested(); } diff --git a/test/unit/math/rev/core/std_iterator_traits_test.cpp b/test/unit/math/rev/core/std_iterator_traits_test.cpp index 1f7cdd2c15a..8a0c05fcb73 100644 --- a/test/unit/math/rev/core/std_iterator_traits_test.cpp +++ b/test/unit/math/rev/core/std_iterator_traits_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(revCore, stdIteratorTraits) { +TEST_F(AgradRev, revCore_stdIteratorTraits) { using stan::math::var; using traits = std::iterator_traits; var a; diff --git a/test/unit/math/rev/core/thread_stack_instance_test.cpp b/test/unit/math/rev/core/thread_stack_instance_test.cpp index 389c8129cb8..a458cc37485 100644 --- a/test/unit/math/rev/core/thread_stack_instance_test.cpp +++ b/test/unit/math/rev/core/thread_stack_instance_test.cpp @@ -1,9 +1,11 @@ #include #include +#include +#include #include -TEST(thread_stack_instance, initialize) { +TEST_F(AgradRev, thread_stack_instance_initialize) { using stan::math::ChainableStack; // the main thread must be initialized by the time this code is @@ -31,7 +33,7 @@ TEST(thread_stack_instance, initialize) { } // tear down in a thread the stack and refresh it -TEST(thread_stack_instance, repeated_initialize) { +TEST_F(AgradRev, thread_stack_instance_repeated_initialize) { using stan::math::ChainableStack; // the main thread must be initialized by the time this code is @@ -79,7 +81,7 @@ TEST(thread_stack_instance, repeated_initialize) { other_work.join(); } -TEST(thread_stack_instance, child_instances) { +TEST_F(AgradRev, thread_stack_instance_child_instances) { using stan::math::ChainableStack; // place a var on the stack such that a fresh stack in another // thread will be different at initialization (if STAN_THREADS is @@ -110,7 +112,7 @@ TEST(thread_stack_instance, child_instances) { other_work.join(); } -TEST(thread_stack_instance, persistence) { +TEST_F(AgradRev, thread_stack_instance_persistence) { using stan::math::ChainableStack; ChainableStack::AutodiffStackStorage* main_ad_stack diff --git a/test/unit/math/rev/core/var_stack_test.cpp b/test/unit/math/rev/core/var_stack_test.cpp index b310e6711cb..72bc2abe89c 100644 --- a/test/unit/math/rev/core/var_stack_test.cpp +++ b/test/unit/math/rev/core/var_stack_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -10,7 +11,7 @@ struct foo : public stan::math::chainable_alloc { void chain() {} }; -TEST(AgradRevStack, varStackRecoverNestedSegFaultFix) { +TEST_F(AgradRev, RevStack_varStackRecoverNestedSegFaultFix) { // this test failed in 2.5, but passes in 2.6 stan::math::start_nested(); foo* x = new foo(); @@ -21,7 +22,7 @@ TEST(AgradRevStack, varStackRecoverNestedSegFaultFix) { } // just test basic autodiff; no more free_memory operation -TEST(AgradRevStack, varStack) { +TEST_F(AgradRev, RevStack_varStack) { stan::math::var a = 2.0; stan::math::var b = -3.0; stan::math::var f = a * b; @@ -45,13 +46,13 @@ TEST(AgradRevStack, varStack) { EXPECT_FLOAT_EQ(2.0, grad_ff[1]); } -TEST(AgradRevStack, recoverMemoryLogicError) { +TEST_F(AgradRev, RevStack_recoverMemoryLogicError) { stan::math::start_nested(); EXPECT_THROW(stan::math::recover_memory(), std::logic_error); // clean up for next test stan::math::recover_memory_nested(); } -TEST(AgradRevStack, recoverMemoryNestedLogicError) { +TEST_F(AgradRev, RevStack_recoverMemoryNestedLogicError) { EXPECT_THROW(stan::math::recover_memory_nested(), std::logic_error); } diff --git a/test/unit/math/rev/core/vari_test.cpp b/test/unit/math/rev/core/vari_test.cpp index a45e731b4ac..55860ffd9b8 100644 --- a/test/unit/math/rev/core/vari_test.cpp +++ b/test/unit/math/rev/core/vari_test.cpp @@ -1,23 +1,25 @@ #include #include +#include +#include #include #include -TEST(AgradRevVari, insertion_operator) { +TEST_F(AgradRev, RevVari_insertion_operator) { stan::math::vari v(5); std::stringstream ss; ss << &v; EXPECT_EQ("5:0", ss.str()); } -TEST(AgradRevVari, long_double_test) { +TEST_F(AgradRev, RevVari_long_double_test) { stan::math::vari_value v(5); std::stringstream ss; ss << &v; EXPECT_EQ("5:0", ss.str()); } -TEST(AgradRevVari, dense_matrix_vari) { +TEST_F(AgradRev, RevVari_dense_matrix_vari) { using stan::math::vari_value; using eig_mat = Eigen::MatrixXd; vari_value A_vari(eig_mat::Random(3, 3)); @@ -25,7 +27,7 @@ TEST(AgradRevVari, dense_matrix_vari) { vari_value B_vari(B); EXPECT_MATRIX_FLOAT_EQ(B, B_vari.val()); } -TEST(AgradRevVari, dense_vector_vari) { +TEST_F(AgradRev, RevVari_dense_vector_vari) { using stan::math::vari_value; using eig_vec = Eigen::Matrix; vari_value A_vari(eig_vec::Random(3)); @@ -34,7 +36,7 @@ TEST(AgradRevVari, dense_vector_vari) { EXPECT_MATRIX_FLOAT_EQ(B, B_vari.val()); } -TEST(AgradRevVari, dense_row_vector_vari) { +TEST_F(AgradRev, RevVari_dense_row_vector_vari) { using stan::math::vari_value; using eig_row_vec = Eigen::Matrix; vari_value A_vari(eig_row_vec::Random(3)); @@ -43,7 +45,7 @@ TEST(AgradRevVari, dense_row_vector_vari) { EXPECT_MATRIX_FLOAT_EQ(B, B_vari.val()); } -TEST(AgradRevVari, sparse_matrix_vari) { +TEST_F(AgradRev, RevVari_sparse_matrix_vari) { using stan::math::vari_value; using eig_mat = Eigen::SparseMatrix; using inner_iterator = typename eig_mat::InnerIterator; @@ -60,7 +62,7 @@ TEST(AgradRevVari, sparse_matrix_vari) { } } -TEST(AgradRevVari, arena_matrix_matrix_vari) { +TEST_F(AgradRev, RevVari_arena_matrix_matrix_vari) { using stan::math::arena_matrix; using stan::math::vari_value; arena_matrix x(Eigen::MatrixXd::Random(5, 5)); @@ -82,7 +84,7 @@ TEST(AgradRevVari, arena_matrix_matrix_vari) { EXPECT_EQ((*F).val().data(), (*F).adj().data()); } -TEST(AgradRevVari, dense_vari_matrix_views) { +TEST_F(AgradRev, RevVari_dense_vari_matrix_views) { using stan::math::vari_value; using eig_mat = Eigen::MatrixXd; eig_mat A(5, 5); @@ -127,7 +129,7 @@ TEST(AgradRevVari, dense_vari_matrix_views) { EXPECT_MATRIX_FLOAT_EQ(A, A_v.val()); } -TEST(AgradRevVari, dense_vari_vector_views) { +TEST_F(AgradRev, RevVari_dense_vari_vector_views) { using stan::math::vari_value; using eig_vec = Eigen::VectorXd; eig_vec A(10); @@ -160,7 +162,7 @@ TEST(AgradRevVari, dense_vari_vector_views) { EXPECT_MATRIX_FLOAT_EQ(A_segment.adj(), A_v.adj().segment(3, 5)); } -TEST(AgradRevVari, dense_vari_row_vector_views) { +TEST_F(AgradRev, RevVari_dense_vari_row_vector_views) { using stan::math::vari_value; using eig_vec = Eigen::RowVectorXd; eig_vec A(10); diff --git a/test/unit/math/rev/core/zero_adjoints_test.cpp b/test/unit/math/rev/core/zero_adjoints_test.cpp index f04566fd55b..bbc1c72cd1c 100644 --- a/test/unit/math/rev/core/zero_adjoints_test.cpp +++ b/test/unit/math/rev/core/zero_adjoints_test.cpp @@ -1,11 +1,12 @@ #include #include +#include #include #include #include #include -TEST(AgradRevZero, zero_arithmetic) { +TEST_F(AgradRev, RevZero_zero_arithmetic) { int a = 1.0; double b = 2; std::vector va(5, a); @@ -36,7 +37,7 @@ TEST(AgradRevZero, zero_arithmetic) { std::forward_as_tuple(a, b, va, vb, c, d, e, vva, vvb, vc, vd, ve)); } -TEST(AgradRevZero, zero_var) { +TEST_F(AgradRev, RevZero_zero_var) { using stan::math::var; using stan::math::vari; @@ -49,7 +50,7 @@ TEST(AgradRevZero, zero_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_std_vector_var) { +TEST_F(AgradRev, RevZero_zero_std_vector_var) { using stan::math::var; using stan::math::vari; @@ -64,7 +65,7 @@ TEST(AgradRevZero, zero_std_vector_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_vector_var) { +TEST_F(AgradRev, RevZero_zero_vector_var) { using stan::math::var; using stan::math::vari; @@ -80,7 +81,7 @@ TEST(AgradRevZero, zero_vector_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_row_vector_var) { +TEST_F(AgradRev, RevZero_zero_row_vector_var) { using stan::math::var; using stan::math::vari; @@ -96,7 +97,7 @@ TEST(AgradRevZero, zero_row_vector_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_matrix_var) { +TEST_F(AgradRev, RevZero_zero_matrix_var) { using stan::math::var; using stan::math::vari; @@ -112,7 +113,7 @@ TEST(AgradRevZero, zero_matrix_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_std_vector_std_vector_var) { +TEST_F(AgradRev, RevZero_zero_std_vector_std_vector_var) { using stan::math::var; using stan::math::vari; @@ -132,7 +133,7 @@ TEST(AgradRevZero, zero_std_vector_std_vector_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_std_vector_vector_var) { +TEST_F(AgradRev, RevZero_zero_std_vector_vector_var) { using stan::math::var; using stan::math::vari; @@ -155,7 +156,7 @@ TEST(AgradRevZero, zero_std_vector_vector_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_std_vector_row_vector_var) { +TEST_F(AgradRev, RevZero_zero_std_vector_row_vector_var) { using stan::math::var; using stan::math::vari; @@ -178,7 +179,7 @@ TEST(AgradRevZero, zero_std_vector_row_vector_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_std_vector_matrix_var) { +TEST_F(AgradRev, RevZero_zero_std_vector_matrix_var) { using stan::math::var; using stan::math::vari; @@ -202,7 +203,7 @@ TEST(AgradRevZero, zero_std_vector_matrix_var) { stan::math::recover_memory(); } -TEST(AgradRevZero, zero_multi) { +TEST_F(AgradRev, RevZero_zero_multi) { using stan::math::var; using stan::math::vari; diff --git a/test/unit/math/rev/eigen_plugins_test.cpp b/test/unit/math/rev/eigen_plugins_test.cpp index b7c67917fd7..47d57ede601 100644 --- a/test/unit/math/rev/eigen_plugins_test.cpp +++ b/test/unit/math/rev/eigen_plugins_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevMatrixAddons, var_matrix) { +TEST_F(AgradRev, RevMatrixAddons_var_matrix) { using Eigen::MatrixXd; using stan::math::matrix_v; using stan::math::matrix_vi; @@ -49,7 +50,7 @@ TEST(AgradRevMatrixAddons, var_matrix) { EXPECT_EQ(mat_vi.adj().cols(), derivs.cols()); } -TEST(AgradRevMatrixAddons, var_vector) { +TEST_F(AgradRev, RevMatrixAddons_var_vector) { using Eigen::VectorXd; using stan::math::vector_v; using stan::math::vector_vi; @@ -89,7 +90,7 @@ TEST(AgradRevMatrixAddons, var_vector) { EXPECT_EQ(vec_vi.adj().cols(), derivs.cols()); } -TEST(AgradRevMatrixAddons, var_row_vector) { +TEST_F(AgradRev, RevMatrixAddons_var_row_vector) { using Eigen::RowVectorXd; using stan::math::row_vector_v; using stan::math::row_vector_vi; diff --git a/test/unit/math/rev/err/check_bounded_test.cpp b/test/unit/math/rev/err/check_bounded_test.cpp index 3f3e00455ce..6418d8c7173 100644 --- a/test/unit/math/rev/err/check_bounded_test.cpp +++ b/test/unit/math/rev/err/check_bounded_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckBoundedVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckBoundedVarCheckVectorized) { using stan::math::check_bounded; using stan::math::var; using std::vector; @@ -29,7 +30,7 @@ TEST(AgradRevErrorHandlingScalar, CheckBoundedVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckBounded_X) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckBounded_X) { using stan::math::check_bounded; using stan::math::var; @@ -80,7 +81,7 @@ TEST(AgradRevErrorHandlingScalar, CheckBounded_X) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckBounded_Low) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckBounded_Low) { using stan::math::check_bounded; using stan::math::var; @@ -110,7 +111,7 @@ TEST(AgradRevErrorHandlingScalar, CheckBounded_Low) { << ", " << high; stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckBounded_High) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckBounded_High) { using stan::math::check_bounded; using stan::math::var; @@ -141,7 +142,7 @@ TEST(AgradRevErrorHandlingScalar, CheckBounded_High) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckBoundedVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckBoundedVarCheckUnivariate) { using stan::math::check_bounded; using stan::math::var; diff --git a/test/unit/math/rev/err/check_consistent_size_test.cpp b/test/unit/math/rev/err/check_consistent_size_test.cpp index dabf63fdb3b..69f5031023e 100644 --- a/test/unit/math/rev/err/check_consistent_size_test.cpp +++ b/test/unit/math/rev/err/check_consistent_size_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckConsistentSizeVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckConsistentSizeVarCheckVectorized) { using stan::math::check_consistent_size; using stan::math::var; using std::vector; @@ -29,7 +30,7 @@ TEST(AgradRevErrorHandlingScalar, CheckConsistentSizeVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, checkConsistentSize) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkConsistentSize) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::check_consistent_size; @@ -48,7 +49,7 @@ TEST(AgradRevErrorHandlingMatrix, checkConsistentSize) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, checkConsistentSize_nan) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkConsistentSize_nan) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::check_consistent_size; diff --git a/test/unit/math/rev/err/check_consistent_sizes_test.cpp b/test/unit/math/rev/err/check_consistent_sizes_test.cpp index 26c87d413fa..f420fd8568a 100644 --- a/test/unit/math/rev/err/check_consistent_sizes_test.cpp +++ b/test/unit/math/rev/err/check_consistent_sizes_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevErrorHandlingScalar, CheckConsistentSizesVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckConsistentSizesVarCheckVectorized) { using stan::math::check_consistent_sizes; using stan::math::var; using std::vector; @@ -31,7 +32,7 @@ TEST(AgradRevErrorHandlingScalar, CheckConsistentSizesVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, checkConsistentSizes) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkConsistentSizes) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::check_consistent_sizes; diff --git a/test/unit/math/rev/err/check_finite_test.cpp b/test/unit/math/rev/err/check_finite_test.cpp index 99a5ad41bd7..a622881b52d 100644 --- a/test/unit/math/rev/err/check_finite_test.cpp +++ b/test/unit/math/rev/err/check_finite_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckFiniteVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckFiniteVarCheckVectorized) { using stan::math::check_finite; using stan::math::var; using std::vector; @@ -37,7 +38,7 @@ TEST(AgradRevErrorHandlingScalar, CheckFiniteVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckFinite) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckFinite) { using stan::math::check_finite; using stan::math::var; @@ -62,7 +63,7 @@ TEST(AgradRevErrorHandlingScalar, CheckFinite) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckFiniteVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckFiniteVarCheckUnivariate) { using stan::math::check_finite; using stan::math::var; diff --git a/test/unit/math/rev/err/check_greater_or_equal_test.cpp b/test/unit/math/rev/err/check_greater_or_equal_test.cpp index ef3780eaa4b..36446a1f737 100644 --- a/test/unit/math/rev/err/check_greater_or_equal_test.cpp +++ b/test/unit/math/rev/err/check_greater_or_equal_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckGreateOrEqualVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckGreateOrEqualVarCheckVectorized) { using stan::math::check_greater_or_equal; using stan::math::var; using std::vector; @@ -37,7 +38,7 @@ TEST(AgradRevErrorHandlingScalar, CheckGreateOrEqualVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckGreaterOrEqualMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckGreaterOrEqualMatrix) { using stan::math::check_greater_or_equal; using stan::math::var; const char* function = "check_greater_or_equal"; @@ -154,7 +155,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckGreaterOrEqualMatrix) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckGreaterOrEqual) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckGreaterOrEqual) { using stan::math::check_greater_or_equal; using stan::math::var; const char* function = "check_greater_or_equal"; @@ -189,7 +190,7 @@ TEST(AgradRevErrorHandlingScalar, CheckGreaterOrEqual) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckGreaterOrEqualVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckGreaterOrEqualVarCheckUnivariate) { using stan::math::check_greater_or_equal; using stan::math::var; @@ -218,7 +219,7 @@ TEST(AgradRevErrorHandlingScalar, CheckGreaterOrEqualVarCheckUnivariate) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckGreaterOrEqualVarMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckGreaterOrEqualVarMatrix) { using stan::math::check_greater_or_equal; using stan::math::var; using stan::math::var_value; @@ -363,7 +364,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckGreaterOrEqualVarMatrix) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckGreaterOrEqualStdVecVarMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckGreaterOrEqualStdVecVarMatrix) { using stan::math::var; std::vector>>> diff --git a/test/unit/math/rev/err/check_greater_test.cpp b/test/unit/math/rev/err/check_greater_test.cpp index d5d1f77b60f..f8426eb018c 100644 --- a/test/unit/math/rev/err/check_greater_test.cpp +++ b/test/unit/math/rev/err/check_greater_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckGreaterVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckGreaterVarCheckVectorized) { using stan::math::check_greater; using stan::math::var; @@ -35,7 +36,7 @@ TEST(AgradRevErrorHandlingScalar, CheckGreaterVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckGreaterMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckGreaterMatrix) { using stan::math::check_greater; using stan::math::var; @@ -144,7 +145,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckGreaterMatrix) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckGreater) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckGreater) { using stan::math::check_greater; using stan::math::var; @@ -179,7 +180,7 @@ TEST(AgradRevErrorHandlingScalar, CheckGreater) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckGreaterVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckGreaterVarCheckUnivariate) { using stan::math::check_greater; using stan::math::var; @@ -207,7 +208,7 @@ TEST(AgradRevErrorHandlingScalar, CheckGreaterVarCheckUnivariate) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckGreaterStdVecVarMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckGreaterStdVecVarMatrix) { using stan::math::var; std::vector>>> diff --git a/test/unit/math/rev/err/check_less_or_equal_test.cpp b/test/unit/math/rev/err/check_less_or_equal_test.cpp index f44b437552c..3c72534d784 100644 --- a/test/unit/math/rev/err/check_less_or_equal_test.cpp +++ b/test/unit/math/rev/err/check_less_or_equal_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckLessOrEqualVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckLessOrEqualVarCheckVectorized) { using stan::math::check_less_or_equal; using stan::math::var; @@ -35,7 +36,7 @@ TEST(AgradRevErrorHandlingScalar, CheckLessOrEqualVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckLessOrEqual_Matrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckLessOrEqual_Matrix) { using stan::math::check_less_or_equal; using stan::math::var; const char* function = "check_less_or_equal"; @@ -116,7 +117,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckLessOrEqual_Matrix) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckLessOrEqual) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckLessOrEqual) { using stan::math::check_less_or_equal; using stan::math::var; @@ -152,7 +153,7 @@ TEST(AgradRevErrorHandlingScalar, CheckLessOrEqual) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckLessOrEqualVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckLessOrEqualVarCheckUnivariate) { using stan::math::check_less_or_equal; using stan::math::var; @@ -187,7 +188,7 @@ TEST(AgradRevErrorHandlingScalar, CheckLessOrEqualVarCheckUnivariate) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckLessOrEqualStdVecVarMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckLessOrEqualStdVecVarMatrix) { using stan::math::var; std::vector>>> diff --git a/test/unit/math/rev/err/check_less_test.cpp b/test/unit/math/rev/err/check_less_test.cpp index 22f4bc765c1..73bdeb758e5 100644 --- a/test/unit/math/rev/err/check_less_test.cpp +++ b/test/unit/math/rev/err/check_less_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckLessVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckLessVarCheckVectorized) { using stan::math::check_less; using stan::math::var; @@ -35,7 +36,7 @@ TEST(AgradRevErrorHandlingScalar, CheckLessVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckLess_Matrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckLess_Matrix) { using stan::math::check_less; using stan::math::var; @@ -114,7 +115,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckLess_Matrix) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckLess) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckLess) { using stan::math::check_less; using stan::math::var; @@ -149,7 +150,7 @@ TEST(AgradRevErrorHandlingScalar, CheckLess) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckLessVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckLessVarCheckUnivariate) { using stan::math::check_less; using stan::math::var; @@ -177,7 +178,7 @@ TEST(AgradRevErrorHandlingScalar, CheckLessVarCheckUnivariate) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckLessStdVecVarMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckLessStdVecVarMatrix) { using stan::math::var; std::vector>>> diff --git a/test/unit/math/rev/err/check_matching_dims_test.cpp b/test/unit/math/rev/err/check_matching_dims_test.cpp index 43a679616bb..51eee9e86fe 100644 --- a/test/unit/math/rev/err/check_matching_dims_test.cpp +++ b/test/unit/math/rev/err/check_matching_dims_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(ErrorHandlingMatrix, checkMatchingDims_double_var) { +TEST_F(AgradRev, ErrorHandlingMatrix_checkMatchingDims_double_var) { using stan::math::check_matching_dims; std::vector> x; @@ -24,7 +25,7 @@ TEST(ErrorHandlingMatrix, checkMatchingDims_double_var) { std::invalid_argument); } -TEST(ErrorHandlingMatrix, checkMatchingDims_var) { +TEST_F(AgradRev, ErrorHandlingMatrix_checkMatchingDims_var) { using stan::math::check_matching_dims; std::vector> x; diff --git a/test/unit/math/rev/err/check_nonnegative_test.cpp b/test/unit/math/rev/err/check_nonnegative_test.cpp index 93113b8e186..538bf9cfaaa 100644 --- a/test/unit/math/rev/err/check_nonnegative_test.cpp +++ b/test/unit/math/rev/err/check_nonnegative_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -6,7 +7,7 @@ using stan::math::check_nonnegative; using stan::math::var; -TEST(AgradRevErrorHandlingScalar, CheckNonnegativeVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNonnegativeVectorized) { int N = 5; const char* function = "check_nonnegative"; std::vector x(N); @@ -34,7 +35,7 @@ TEST(AgradRevErrorHandlingScalar, CheckNonnegativeVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckNonnegativeVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNonnegativeVarCheckVectorized) { using stan::math::check_nonnegative; using stan::math::var; using std::vector; @@ -82,7 +83,7 @@ TEST(AgradRevErrorHandlingScalar, CheckNonnegativeVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckNonnegative) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNonnegative) { const char* function = "check_nonnegative"; var x = 0; @@ -107,7 +108,7 @@ TEST(AgradRevErrorHandlingScalar, CheckNonnegative) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckNonnegativeVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNonnegativeVarCheckUnivariate) { using stan::math::check_nonnegative; using stan::math::var; diff --git a/test/unit/math/rev/err/check_nonzero_size_test.cpp b/test/unit/math/rev/err/check_nonzero_size_test.cpp index dfb3ad9f3c7..b293b8743bb 100644 --- a/test/unit/math/rev/err/check_nonzero_size_test.cpp +++ b/test/unit/math/rev/err/check_nonzero_size_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(AgradRevErrorHandlingMatrix, checkNonzeroSizeMatrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkNonzeroSizeMatrix) { using stan::math::var; Eigen::Matrix y; using stan::math::check_nonzero_size; @@ -35,7 +36,7 @@ TEST(AgradRevErrorHandlingMatrix, checkNonzeroSizeMatrix) { std::invalid_argument, "a has size 0"); } -TEST(AgradRevErrorHandlingMatrix, checkNonzeroSizeMatrix_nan) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkNonzeroSizeMatrix_nan) { using stan::math::var; Eigen::Matrix y; var result; diff --git a/test/unit/math/rev/err/check_not_nan_test.cpp b/test/unit/math/rev/err/check_not_nan_test.cpp index 820cf12b540..3a50da6746b 100644 --- a/test/unit/math/rev/err/check_not_nan_test.cpp +++ b/test/unit/math/rev/err/check_not_nan_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckNotNanVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNotNanVarCheckVectorized) { using stan::math::check_not_nan; using stan::math::var; @@ -28,7 +29,7 @@ TEST(AgradRevErrorHandlingScalar, CheckNotNanVarCheckVectorized) { stan::math::recover_memory(); } -TEST(ErrorHandlingScalar, CheckNotNanVarCheckVectorized) { +TEST_F(AgradRev, ErrorHandlingScalar_CheckNotNanVarCheckVectorized) { using stan::math::check_not_nan; using stan::math::var; @@ -53,7 +54,7 @@ TEST(ErrorHandlingScalar, CheckNotNanVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckNotNan) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNotNan) { using stan::math::check_not_nan; using stan::math::var; const char* function = "check_not_nan"; @@ -89,7 +90,7 @@ TEST(AgradRevErrorHandlingScalar, CheckNotNan) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckNotNanVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckNotNanVarCheckUnivariate) { using stan::math::check_not_nan; using stan::math::var; @@ -111,7 +112,7 @@ TEST(AgradRevErrorHandlingScalar, CheckNotNanVarCheckUnivariate) { stan::math::recover_memory(); } -TEST(ErrorHandlingScalar, CheckNotNanVarCheckUnivariate) { +TEST_F(AgradRev, ErrorHandlingScalar_CheckNotNanVarCheckUnivariate) { using stan::math::check_not_nan; using stan::math::var; diff --git a/test/unit/math/rev/err/check_pos_definite_test.cpp b/test/unit/math/rev/err/check_pos_definite_test.cpp index 8730bb99e24..abe0f6f8934 100644 --- a/test/unit/math/rev/err/check_pos_definite_test.cpp +++ b/test/unit/math/rev/err/check_pos_definite_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevErrorHandlingMatrix, checkPosDefiniteMatrix_nan) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkPosDefiniteMatrix_nan) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/err/check_pos_semidefinite_test.cpp b/test/unit/math/rev/err/check_pos_semidefinite_test.cpp index d8e634e7031..22236b60a27 100644 --- a/test/unit/math/rev/err/check_pos_semidefinite_test.cpp +++ b/test/unit/math/rev/err/check_pos_semidefinite_test.cpp @@ -1,9 +1,10 @@ #include #include +#include #include #include -TEST(AgradRevErrorHandlingMatrix, checkPosSemiDefiniteMatrix_nan) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkPosSemiDefiniteMatrix_nan) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -35,7 +36,7 @@ TEST(AgradRevErrorHandlingMatrix, checkPosSemiDefiniteMatrix_nan) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, checkPosSemiDefiniteMatrixVarCheck) { +TEST_F(AgradRev, RevErrorHandlingMatrix_checkPosSemiDefiniteMatrixVarCheck) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/err/check_positive_finite_test.cpp b/test/unit/math/rev/err/check_positive_finite_test.cpp index e8fb8af1a92..4111d4c876e 100644 --- a/test/unit/math/rev/err/check_positive_finite_test.cpp +++ b/test/unit/math/rev/err/check_positive_finite_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevErrorHandlingScalar, CheckPositiveFinite_Vector) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckPositiveFinite_Vector) { using stan::math::check_positive_finite; using stan::math::var; @@ -54,7 +55,7 @@ TEST(AgradRevErrorHandlingScalar, CheckPositiveFinite_Vector) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckPositiveFiniteVarCheckVectorized) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckPositiveFiniteVarCheckVectorized) { using stan::math::check_positive_finite; using stan::math::var; @@ -87,7 +88,7 @@ TEST(AgradRevErrorHandlingScalar, CheckPositiveFiniteVarCheckVectorized) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckPositiveFinite_Matrix) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckPositiveFinite_Matrix) { using stan::math::check_positive_finite; using stan::math::var; @@ -126,7 +127,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckPositiveFinite_Matrix) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckPositiveFinite) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckPositiveFinite) { using stan::math::check_positive_finite; using stan::math::var; @@ -154,7 +155,7 @@ TEST(AgradRevErrorHandlingScalar, CheckPositiveFinite) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckPositiveFiniteVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckPositiveFiniteVarCheckUnivariate) { using stan::math::check_positive_finite; using stan::math::var; diff --git a/test/unit/math/rev/err/check_positive_test.cpp b/test/unit/math/rev/err/check_positive_test.cpp index dee6535363f..d08e951b718 100644 --- a/test/unit/math/rev/err/check_positive_test.cpp +++ b/test/unit/math/rev/err/check_positive_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(AgradRevErrorHandlingArray, CheckPositive) { +TEST_F(AgradRev, RevErrorHandlingArray_CheckPositive) { using stan::math::check_positive; using stan::math::var; @@ -20,7 +21,7 @@ TEST(AgradRevErrorHandlingArray, CheckPositive) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingMatrix, CheckPositive) { +TEST_F(AgradRev, RevErrorHandlingMatrix_CheckPositive) { using stan::math::check_positive; using stan::math::var; @@ -39,7 +40,7 @@ TEST(AgradRevErrorHandlingMatrix, CheckPositive) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckPositive) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckPositive) { using stan::math::check_positive; using stan::math::var; @@ -51,7 +52,7 @@ TEST(AgradRevErrorHandlingScalar, CheckPositive) { stan::math::recover_memory(); } -TEST(AgradRevErrorHandlingScalar, CheckPositiveVarCheckUnivariate) { +TEST_F(AgradRev, RevErrorHandlingScalar_CheckPositiveVarCheckUnivariate) { using stan::math::check_positive; using stan::math::var; diff --git a/test/unit/math/rev/err/invalid_argument_test.cpp b/test/unit/math/rev/err/invalid_argument_test.cpp index 87fe0c8fde5..6a6fd9c225f 100644 --- a/test/unit/math/rev/err/invalid_argument_test.cpp +++ b/test/unit/math/rev/err/invalid_argument_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/test/unit/math/rev/err/invalid_argument_vec_test.cpp b/test/unit/math/rev/err/invalid_argument_vec_test.cpp index 44a47f190be..adf41f1c481 100644 --- a/test/unit/math/rev/err/invalid_argument_vec_test.cpp +++ b/test/unit/math/rev/err/invalid_argument_vec_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/err/out_of_range_test.cpp b/test/unit/math/rev/err/out_of_range_test.cpp index c4687ea68dd..45ddde13ebb 100644 --- a/test/unit/math/rev/err/out_of_range_test.cpp +++ b/test/unit/math/rev/err/out_of_range_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/err/throw_domain_error_test.cpp b/test/unit/math/rev/err/throw_domain_error_test.cpp index d00406ca165..e6a1287c59c 100644 --- a/test/unit/math/rev/err/throw_domain_error_test.cpp +++ b/test/unit/math/rev/err/throw_domain_error_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/test/unit/math/rev/err/throw_domain_error_vec_test.cpp b/test/unit/math/rev/err/throw_domain_error_vec_test.cpp index ec3437f6ea4..fca45966446 100644 --- a/test/unit/math/rev/err/throw_domain_error_vec_test.cpp +++ b/test/unit/math/rev/err/throw_domain_error_vec_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/fun/LDLT_factor_test.cpp b/test/unit/math/rev/fun/LDLT_factor_test.cpp index 926a5f902a9..f2d802e772b 100644 --- a/test/unit/math/rev/fun/LDLT_factor_test.cpp +++ b/test/unit/math/rev/fun/LDLT_factor_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevMatrix, LDLT_factor_default_constructor) { +TEST_F(AgradRev, RevMatrix_LDLT_factor_default_constructor) { using stan::math::LDLT_factor; using stan::math::var; @@ -25,7 +26,7 @@ TEST(AgradRevMatrix, LDLT_factor_default_constructor) { stan::math::recover_memory(); } -TEST(AgradRevMatrix, solve) { +TEST_F(AgradRev, RevMatrix_solve) { using stan::math::LDLT_factor; using stan::math::var; @@ -62,7 +63,7 @@ TEST(AgradRevMatrix, solve) { stan::math::recover_memory(); } -TEST(AgradRevMatrix, matrix) { +TEST_F(AgradRev, RevMatrix_matrix) { using stan::math::LDLT_factor; using stan::math::var; diff --git a/test/unit/math/rev/fun/accumulator_test.cpp b/test/unit/math/rev/fun/accumulator_test.cpp index a83793f14a6..7417dabc375 100644 --- a/test/unit/math/rev/fun/accumulator_test.cpp +++ b/test/unit/math/rev/fun/accumulator_test.cpp @@ -8,7 +8,7 @@ void test_sum(stan::math::accumulator& a, int n) { EXPECT_FLOAT_EQ((n * (n + 1)) / 2, a.sum().val()); } -TEST(AgradRevMatrix, accumulateDouble) { +TEST_F(AgradRev, RevMatrix_accumulateDouble) { using stan::math::accumulator; using stan::math::var; @@ -22,7 +22,7 @@ TEST(AgradRevMatrix, accumulateDouble) { a.add(var(i)); test_sum(a, 1000); } -TEST(AgradRevMathMatrix, accumulateCollection) { +TEST_F(AgradRev, RevMathMatrix_accumulateCollection) { // tests int, double, vector, vector, // Matrix, // var, vector, Matrix, @@ -127,7 +127,7 @@ TEST(AgradRevMathMatrix, accumulateCollection) { test_sum(a, pos - 1); } -TEST(AgradRevMatrix, accumulator_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_accumulator_check_varis_on_stack) { stan::math::accumulator a; test::check_varis_on_stack(a.sum()); a.add(1); diff --git a/test/unit/math/rev/fun/as_array_or_scalar_test.cpp b/test/unit/math/rev/fun/as_array_or_scalar_test.cpp index 98aa23b3d80..11a288edcc1 100644 --- a/test/unit/math/rev/fun/as_array_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_array_or_scalar_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include -TEST(MathFunRev, as_array_or_scalar_var_value_matrix) { +TEST_F(AgradRev, MathFunRev_as_array_or_scalar_var_value_matrix) { int n = 100; const Eigen::MatrixXd a_val = Eigen::MatrixXd::Random(n, n); stan::math::var_value a(a_val); @@ -12,7 +13,7 @@ TEST(MathFunRev, as_array_or_scalar_var_value_matrix) { EXPECT_MATRIX_EQ(tmp.val(), a_val); } -TEST(MathFunRev, as_array_or_scalar_var_value_vector) { +TEST_F(AgradRev, MathFunRev_as_array_or_scalar_var_value_vector) { int n = 100; const Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); @@ -21,7 +22,7 @@ TEST(MathFunRev, as_array_or_scalar_var_value_vector) { EXPECT_MATRIX_EQ(tmp.val(), a_val); } -TEST(MathFunRev, as_array_or_scalar_var_value_rowvector) { +TEST_F(AgradRev, MathFunRev_as_array_or_scalar_var_value_rowvector) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/fun/as_bool_test.cpp b/test/unit/math/rev/fun/as_bool_test.cpp index 80f730f37a7..6922262a846 100644 --- a/test/unit/math/rev/fun/as_bool_test.cpp +++ b/test/unit/math/rev/fun/as_bool_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRev, asBool) { +TEST_F(AgradRev, Rev_asBool) { using stan::math::as_bool; using stan::math::var; @@ -20,7 +21,7 @@ TEST(AgradRev, asBool) { EXPECT_FALSE(as_bool(var(0.0))); EXPECT_FALSE(as_bool(var(0.0f))); } -TEST(AgradRev, as_bool_nan) { +TEST_F(AgradRev, Rev_as_bool_nan) { stan::math::var nan = std::numeric_limits::quiet_NaN(); EXPECT_TRUE(stan::math::as_bool(nan)); } diff --git a/test/unit/math/rev/fun/as_column_vector_or_scalar_test.cpp b/test/unit/math/rev/fun/as_column_vector_or_scalar_test.cpp index e29d1200eaa..d9fd95bf42c 100644 --- a/test/unit/math/rev/fun/as_column_vector_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_column_vector_or_scalar_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include -TEST(MathFunRev, as_column_vector_or_scalar_var_value_vector) { +TEST_F(AgradRev, MathFunRev_as_column_vector_or_scalar_var_value_vector) { int n = 100; const Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); @@ -12,7 +13,7 @@ TEST(MathFunRev, as_column_vector_or_scalar_var_value_vector) { EXPECT_MATRIX_EQ(tmp.val(), a_val); } -TEST(MathFunRev, as_column_vector_or_scalar_var_value_rowvector) { +TEST_F(AgradRev, MathFunRev_as_column_vector_or_scalar_var_value_rowvector) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/fun/as_value_array_or_scalar_test.cpp b/test/unit/math/rev/fun/as_value_array_or_scalar_test.cpp index 1016326a045..980cc361a6f 100644 --- a/test/unit/math/rev/fun/as_value_array_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_value_array_or_scalar_test.cpp @@ -1,15 +1,16 @@ #include +#include #include #include #include -TEST(MathFunRev, as_value_array_or_scalar_scalar) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_scalar) { double b_val = 4; stan::math::var b(b_val); EXPECT_EQ(b_val, stan::math::as_value_array_or_scalar(b)); } -TEST(MathFunRev, as_value_array_or_scalar_std_vector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_std_vector_lvalue) { int n = 100; Eigen::ArrayXd a_val = Eigen::ArrayXd::Random(n); std::vector b_val(n); @@ -23,7 +24,7 @@ TEST(MathFunRev, as_value_array_or_scalar_std_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_array_or_scalar_std_vector_rvalue) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_std_vector_rvalue) { int n = 100; Eigen::ArrayXd a_val = Eigen::ArrayXd::Random(n); std::vector b_val(n); @@ -37,7 +38,7 @@ TEST(MathFunRev, as_value_array_or_scalar_std_vector_rvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_array_or_scalar_matrix_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_matrix_lvalue) { int n = 100; Eigen::MatrixXd a_val = Eigen::MatrixXd::Random(n, n); Eigen::Matrix a(a_val); @@ -47,7 +48,7 @@ TEST(MathFunRev, as_value_array_or_scalar_matrix_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_array_or_scalar_const_matrix_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_const_matrix_lvalue) { int n = 100; const Eigen::MatrixXd a_val = Eigen::MatrixXd::Random(n, n); Eigen::Matrix a(a_val); @@ -57,7 +58,7 @@ TEST(MathFunRev, as_value_array_or_scalar_const_matrix_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_array_or_scalar_matrix_rvalue) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_matrix_rvalue) { int n = 10; Eigen::MatrixXd a_val = Eigen::MatrixXd::Random(n, n); Eigen::Matrix a(a_val); @@ -68,7 +69,7 @@ TEST(MathFunRev, as_value_array_or_scalar_matrix_rvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_array_or_scalar_var_value) { +TEST_F(AgradRev, MathFunRev_as_value_array_or_scalar_var_value) { int n = 100; const Eigen::MatrixXd a_val = Eigen::MatrixXd::Random(n, n); stan::math::var_value> a(a_val); diff --git a/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp b/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp index d0bc1a61113..629b6c94dea 100644 --- a/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp @@ -1,15 +1,16 @@ #include +#include #include #include #include -TEST(MathFunRev, as_value_column_array_or_scalar_scalar) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_scalar) { double b_val = 4; stan::math::var b(b_val); EXPECT_EQ(b_val, stan::math::as_value_column_array_or_scalar(b)); } -TEST(MathFunRev, as_value_column_array_or_scalar_std_vector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_std_vector_lvalue) { int n = 100; Eigen::ArrayXd a_val = Eigen::ArrayXd::Random(n); std::vector b_val(n); @@ -24,7 +25,7 @@ TEST(MathFunRev, as_value_column_array_or_scalar_std_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_array_or_scalar_std_vector_rvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_std_vector_rvalue) { int n = 100; Eigen::ArrayXd a_val = Eigen::ArrayXd::Random(n); std::vector b_val(n); @@ -39,7 +40,7 @@ TEST(MathFunRev, as_value_column_array_or_scalar_std_vector_rvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_array_or_scalar_vector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_vector_lvalue) { int n = 100; Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); Eigen::Matrix a(a_val); @@ -50,7 +51,7 @@ TEST(MathFunRev, as_value_column_array_or_scalar_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_array_or_scalar_const_rowvector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_const_rowvector_lvalue) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); Eigen::Matrix a(a_val); @@ -61,7 +62,7 @@ TEST(MathFunRev, as_value_column_array_or_scalar_const_rowvector_lvalue) { EXPECT_MATRIX_EQ(res, a_val.transpose()); } -TEST(MathFunRev, as_value_column_array_or_scalar_rowvector_rvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_rowvector_rvalue) { int n = 10; Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); Eigen::Matrix a(a_val); @@ -73,7 +74,7 @@ TEST(MathFunRev, as_value_column_array_or_scalar_rowvector_rvalue) { EXPECT_MATRIX_EQ(res, a_val.transpose()); } -TEST(MathFunRev, as_value_column_array_or_scalar_var_value_vector) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_var_value_vector) { int n = 100; const Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); @@ -84,7 +85,7 @@ TEST(MathFunRev, as_value_column_array_or_scalar_var_value_vector) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_array_or_scalar_var_value_row_vector) { +TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_var_value_row_vector) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp b/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp index 678ea65fc65..10cdbf2e775 100644 --- a/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp @@ -1,15 +1,16 @@ #include +#include #include #include #include -TEST(MathFunRev, as_value_column_vector_or_scalar_scalar) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_scalar) { double b_val = 4; stan::math::var b(b_val); EXPECT_EQ(b_val, stan::math::as_value_column_vector_or_scalar(b)); } -TEST(MathFunRev, as_value_column_vector_or_scalar_std_vector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_std_vector_lvalue) { int n = 100; Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); std::vector b_val(n); @@ -23,7 +24,7 @@ TEST(MathFunRev, as_value_column_vector_or_scalar_std_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_vector_or_scalar_std_vector_rvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_std_vector_rvalue) { int n = 100; Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); std::vector b_val(n); @@ -37,7 +38,7 @@ TEST(MathFunRev, as_value_column_vector_or_scalar_std_vector_rvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_vector_or_scalar_vector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_vector_lvalue) { int n = 100; Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); Eigen::Matrix a(a_val); @@ -47,7 +48,7 @@ TEST(MathFunRev, as_value_column_vector_or_scalar_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_vector_or_scalar_const_rowvector_lvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_const_rowvector_lvalue) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); Eigen::Matrix a(a_val); @@ -57,7 +58,7 @@ TEST(MathFunRev, as_value_column_vector_or_scalar_const_rowvector_lvalue) { EXPECT_MATRIX_EQ(res, a_val.transpose()); } -TEST(MathFunRev, as_value_column_vector_or_scalar_rowvector_rvalue) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_rowvector_rvalue) { int n = 10; Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); Eigen::Matrix a(a_val); @@ -68,7 +69,7 @@ TEST(MathFunRev, as_value_column_vector_or_scalar_rowvector_rvalue) { EXPECT_MATRIX_EQ(res, a_val.transpose()); } -TEST(MathFunRev, as_value_column_vector_or_scalar_var_value_vector) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_var_value_vector) { int n = 100; const Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); @@ -78,7 +79,7 @@ TEST(MathFunRev, as_value_column_vector_or_scalar_var_value_vector) { EXPECT_MATRIX_EQ(res, a_val); } -TEST(MathFunRev, as_value_column_vector_or_scalar_var_value_row_vector) { +TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_var_value_row_vector) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/fun/assign_test.cpp b/test/unit/math/rev/fun/assign_test.cpp index 882a854424a..df344f6a5f4 100644 --- a/test/unit/math/rev/fun/assign_test.cpp +++ b/test/unit/math/rev/fun/assign_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(MathMatrixRevMat, getAssignRowVar) { +TEST_F(AgradRev, MathMatrixRevMat_getAssignRowVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::assign; @@ -21,7 +22,7 @@ TEST(MathMatrixRevMat, getAssignRowVar) { EXPECT_FLOAT_EQ(1000.0, m(0, 2).val()); } -TEST(AgradRevMatrix, assign) { +TEST_F(AgradRev, RevMatrix_assign) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::assign; @@ -87,7 +88,7 @@ TEST(AgradRevMatrix, assign) { EXPECT_FLOAT_EQ(100, m_var(1, 0).val()); EXPECT_FLOAT_EQ(300, m_var(1, 2).val()); } -TEST(AgradRevMatrix, assign_error) { +TEST_F(AgradRev, RevMatrix_assign_error) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::assign; @@ -116,7 +117,7 @@ TEST(AgradRevMatrix, assign_error) { EXPECT_THROW(assign(m_var, m_dbl), std::invalid_argument); } -TEST(MathAssign, VarDouble) { +TEST_F(AgradRev, MathAssign_VarDouble) { using stan::math::assign; using stan::math::var; var x; diff --git a/test/unit/math/rev/fun/binomial_coefficient_log_test.cpp b/test/unit/math/rev/fun/binomial_coefficient_log_test.cpp index c70e37a2c72..022ad56976d 100644 --- a/test/unit/math/rev/fun/binomial_coefficient_log_test.cpp +++ b/test/unit/math/rev/fun/binomial_coefficient_log_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -8,7 +9,7 @@ #include #include -TEST(MathFunctions, binomial_coefficient_log_identities) { +TEST_F(AgradRev, MathFunctions_binomial_coefficient_log_identities) { using stan::math::binomial_coefficient_log; using stan::math::is_nan; using stan::math::log; @@ -296,7 +297,7 @@ std::vector testValues = { } // namespace binomial_coefficient_log_test_internal -TEST(MathFunctions, binomial_coefficient_log_precomputed) { +TEST_F(AgradRev, MathFunctions_binomial_coefficient_log_precomputed) { using binomial_coefficient_log_test_internal::TestValue; using binomial_coefficient_log_test_internal::testValues; using binomial_coefficient_log_test_internal::testValuesEdge; diff --git a/test/unit/math/rev/fun/cholesky_decompose_test.cpp b/test/unit/math/rev/fun/cholesky_decompose_test.cpp index d04fab845a2..ee5ca7f5069 100644 --- a/test/unit/math/rev/fun/cholesky_decompose_test.cpp +++ b/test/unit/math/rev/fun/cholesky_decompose_test.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include @@ -350,7 +350,7 @@ double test_gradient(int size, double prec) { return grads_ad.sum(); } -TEST(AgradRevMatrix, mat_cholesky) { +TEST_F(AgradRev, RevMatrix_mat_cholesky) { using stan::math::cholesky_decompose; using stan::math::matrix_v; using stan::math::singular_values; @@ -375,7 +375,7 @@ TEST(AgradRevMatrix, mat_cholesky) { EXPECT_NO_THROW(singular_values(X)); } -TEST(AgradRevMatrix, exception_mat_cholesky) { +TEST_F(AgradRev, RevMatrix_exception_mat_cholesky) { stan::math::matrix_v m; // not positive definite @@ -397,7 +397,7 @@ TEST(AgradRevMatrix, exception_mat_cholesky) { EXPECT_THROW(stan::math::cholesky_decompose(m), std::domain_error); } -TEST(AgradRevMatrix, exception_varmat_cholesky) { +TEST_F(AgradRev, RevMatrix_exception_varmat_cholesky) { stan::math::matrix_d m; // not positive definite @@ -423,21 +423,21 @@ TEST(AgradRevMatrix, exception_varmat_cholesky) { EXPECT_THROW(stan::math::cholesky_decompose(mv4), std::domain_error); } -TEST(AgradRevMatrix, mat_cholesky_1st_deriv_small) { +TEST_F(AgradRev, RevMatrix_mat_cholesky_1st_deriv_small) { test_gradients(9, 1e-10); test_gradients_simple(10, 1e-10); test_gradient(15, 1e-10); test_gp_grad(20, 1e-10); } -TEST(AgradRevMatrix, check_varis_on_stack_small) { +TEST_F(AgradRev, RevMatrix_check_varis_on_stack_small) { stan::math::matrix_v X(2, 2); X << 3, -1, -1, 1; test::check_varis_on_stack(stan::math::cholesky_decompose(X)); } -TEST(AgradRevMatrix, mat_cholesky_1st_deriv_large_gradients) { +TEST_F(AgradRev, RevMatrix_mat_cholesky_1st_deriv_large_gradients) { test_gradient(36, 1e-08); test_gp_grad(100, 1e-08); test_gp_grad(1000, 1e-08); @@ -445,7 +445,7 @@ TEST(AgradRevMatrix, mat_cholesky_1st_deriv_large_gradients) { test_simple_vec_mult(45, 1e-08); } -TEST(AgradRevMatrix, cholesky_replicated_input) { +TEST_F(AgradRev, RevMatrix_cholesky_replicated_input) { using stan::math::var; auto f = [](int size, const auto& y) { diff --git a/test/unit/math/rev/fun/cols_test.cpp b/test/unit/math/rev/fun/cols_test.cpp index 511d2143dff..2ac1ad7f11b 100644 --- a/test/unit/math/rev/fun/cols_test.cpp +++ b/test/unit/math/rev/fun/cols_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevMatrix, cols_vector) { +TEST_F(AgradRev, RevMatrix_cols_vector) { using stan::math::cols; using stan::math::row_vector_v; using stan::math::var_value; @@ -18,7 +19,7 @@ TEST(AgradRevMatrix, cols_vector) { vec_v.resize(0); EXPECT_EQ(1U, cols(vec_v)); } -TEST(AgradRevMatrix, cols_rowvector) { +TEST_F(AgradRev, RevMatrix_cols_rowvector) { using stan::math::cols; using stan::math::row_vector_v; using stan::math::var_value; @@ -33,7 +34,7 @@ TEST(AgradRevMatrix, cols_rowvector) { EXPECT_EQ(0U, cols(rv)); } -TEST(AgradRevMatrix, cols_matrix) { +TEST_F(AgradRev, RevMatrix_cols_matrix) { using stan::math::cols; using stan::math::matrix_v; using stan::math::var_value; diff --git a/test/unit/math/rev/fun/cov_exp_quad_test.cpp b/test/unit/math/rev/fun/cov_exp_quad_test.cpp index 90a3269ed3f..ed42ebc6f95 100644 --- a/test/unit/math/rev/fun/cov_exp_quad_test.cpp +++ b/test/unit/math/rev/fun/cov_exp_quad_test.cpp @@ -1,12 +1,12 @@ #include -#include #include +#include #include #include #include #include -TEST(RevMath, cov_exp_quad_vvv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vvv) { Eigen::Matrix cov; for (std::size_t i = 0; i < 3; ++i) { @@ -54,7 +54,7 @@ TEST(RevMath, cov_exp_quad_vvv) { } } -TEST(RevMath, cov_exp_quad_vvd) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vvd) { Eigen::Matrix cov; double l = 5; @@ -98,7 +98,7 @@ TEST(RevMath, cov_exp_quad_vvd) { } } -TEST(RevMath, cov_exp_quad_vdv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vdv) { Eigen::Matrix cov; double sigma = 0.2; @@ -139,7 +139,7 @@ TEST(RevMath, cov_exp_quad_vdv) { } } -TEST(RevMath, cov_exp_quad_vdd) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vdd) { Eigen::Matrix cov; double sigma = 0.2; double l = 5; @@ -176,7 +176,7 @@ TEST(RevMath, cov_exp_quad_vdd) { } } -TEST(RevMath, cov_exp_quad_dvv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_dvv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -216,7 +216,7 @@ TEST(RevMath, cov_exp_quad_dvv) { } } -TEST(RevMath, cov_exp_quad_dvd) { +TEST_F(AgradRev, RevMath_cov_exp_quad_dvd) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -251,7 +251,7 @@ TEST(RevMath, cov_exp_quad_dvd) { } } -TEST(RevMath, cov_exp_quad_ddv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_ddv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -285,7 +285,7 @@ TEST(RevMath, cov_exp_quad_ddv) { } } -TEST(RevMath, cov_exp_quad_vector_vvv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_vvv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; @@ -352,7 +352,7 @@ TEST(RevMath, cov_exp_quad_vector_vvv) { } } -TEST(RevMath, cov_exp_quad_vector_vvd) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_vvd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double l = 5; @@ -414,7 +414,7 @@ TEST(RevMath, cov_exp_quad_vector_vvd) { } } -TEST(RevMath, cov_exp_quad_vector_vdv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_vdv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -476,7 +476,7 @@ TEST(RevMath, cov_exp_quad_vector_vdv) { } } -TEST(RevMath, cov_exp_quad_vector_vdd) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_vdd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -533,7 +533,7 @@ TEST(RevMath, cov_exp_quad_vector_vdd) { } } -TEST(RevMath, cov_exp_quad_vector_dvv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_dvv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -603,7 +603,7 @@ TEST(RevMath, cov_exp_quad_vector_dvv) { } } -TEST(RevMath, cov_exp_quad_vector_dvd) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_dvd) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; std::vector x(3); @@ -648,7 +648,7 @@ TEST(RevMath, cov_exp_quad_vector_dvd) { } } -TEST(RevMath, cov_exp_quad_vector_ddv) { +TEST_F(AgradRev, RevMath_cov_exp_quad_vector_ddv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; std::vector x(3); @@ -693,7 +693,7 @@ TEST(RevMath, cov_exp_quad_vector_ddv) { } } -TEST(RevMath, cov_exp_quad1_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_cov_exp_quad1_vec_eigen_rvec) { using stan::math::squared_distance; using stan::math::var; @@ -720,7 +720,7 @@ TEST(RevMath, cov_exp_quad1_vec_eigen_rvec) { << "index: (" << i << ", " << j << ")"; } -TEST(RevMath, cov_exp_quad2_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_cov_exp_quad2_vec_eigen_rvec) { using stan::math::squared_distance; using stan::math::var; var sigma = 0.2; @@ -766,7 +766,7 @@ TEST(RevMath, cov_exp_quad2_vec_eigen_rvec) { } } -TEST(RevMath, cov_exp_quad2_vec_eigen_mixed) { +TEST_F(AgradRev, RevMath_cov_exp_quad2_vec_eigen_mixed) { using stan::math::squared_distance; using stan::math::var; var sigma = 0.2; @@ -903,7 +903,7 @@ TEST(RevMath, cov_exp_quad2_vec_eigen_mixed) { } } -TEST(RevMath, cov_exp_quad_domain_error_training) { +TEST_F(AgradRev, RevMath_cov_exp_quad_domain_error_training) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -946,7 +946,7 @@ TEST(RevMath, cov_exp_quad_domain_error_training) { std::domain_error); } -TEST(RevMath, cov_exp_quad_nan_error_training) { +TEST_F(AgradRev, RevMath_cov_exp_quad_nan_error_training) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1020,7 +1020,7 @@ TEST(RevMath, cov_exp_quad_nan_error_training) { std::domain_error); } -TEST(RevMath, cov_exp_quad_domain_error) { +TEST_F(AgradRev, RevMath_cov_exp_quad_domain_error) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1099,7 +1099,7 @@ TEST(RevMath, cov_exp_quad_domain_error) { std::domain_error); } -TEST(RevMath, cov_exp_quad2_nan_domain_error) { +TEST_F(AgradRev, RevMath_cov_exp_quad2_nan_domain_error) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1227,7 +1227,7 @@ TEST(RevMath, cov_exp_quad2_nan_domain_error) { std::domain_error); } -TEST(RevMath, cov_exp_quad2_dim_mismatch_vec_eigen_vec) { +TEST_F(AgradRev, RevMath_cov_exp_quad2_dim_mismatch_vec_eigen_vec) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1248,7 +1248,7 @@ TEST(RevMath, cov_exp_quad2_dim_mismatch_vec_eigen_vec) { std::invalid_argument); } -TEST(RevMath, cov_exp_quad2_dim_mismatch_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_cov_exp_quad2_dim_mismatch_vec_eigen_rvec) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1269,7 +1269,7 @@ TEST(RevMath, cov_exp_quad2_dim_mismatch_vec_eigen_rvec) { std::invalid_argument); } -TEST(RevMath, cov_exp_quad2_dim_mismatch_vec_eigen_mixed) { +TEST_F(AgradRev, RevMath_cov_exp_quad2_dim_mismatch_vec_eigen_mixed) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1308,7 +1308,7 @@ TEST(RevMath, cov_exp_quad2_dim_mismatch_vec_eigen_mixed) { EXPECT_THROW(stan::math::cov_exp_quad(x_vec_2, x_rvec_2, sigma, l), std::invalid_argument); } -TEST(AgradRevMatrix, cov_exp_quad_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_cov_exp_quad_check_varis_on_stack) { using stan::math::to_var; std::vector x(3); double sigma = 0.2; diff --git a/test/unit/math/rev/fun/dimensions_test.cpp b/test/unit/math/rev/fun/dimensions_test.cpp index 9aa32037efd..8c4b4d9865c 100644 --- a/test/unit/math/rev/fun/dimensions_test.cpp +++ b/test/unit/math/rev/fun/dimensions_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevMatrix, col_varmat) { +TEST_F(AgradRev, RevMatrix_col_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -12,7 +13,7 @@ TEST(AgradRevMatrix, col_varmat) { EXPECT_MATRIX_FLOAT_EQ(stan::math::col(m_v, 2).val(), stan::math::col(m, 2)); } -TEST(AgradRevMatrix, row_varmat) { +TEST_F(AgradRev, RevMatrix_row_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -21,7 +22,7 @@ TEST(AgradRevMatrix, row_varmat) { EXPECT_MATRIX_FLOAT_EQ(stan::math::row(m_v, 2).val(), stan::math::row(m, 2)); } -TEST(AgradRevMatrix, dims_varmat) { +TEST_F(AgradRev, RevMatrix_dims_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -29,7 +30,7 @@ TEST(AgradRevMatrix, dims_varmat) { var_value m_v(m); EXPECT_STD_VECTOR_EQ(stan::math::dims(m_v), stan::math::dims(m)); } -TEST(AgradRevMatrix, num_elements_varmat) { +TEST_F(AgradRev, RevMatrix_num_elements_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -38,7 +39,7 @@ TEST(AgradRevMatrix, num_elements_varmat) { EXPECT_EQ(stan::math::num_elements(m_v), stan::math::num_elements(m)); } -TEST(AgradRevMatrix, diagonal_varmat) { +TEST_F(AgradRev, RevMatrix_diagonal_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -48,7 +49,7 @@ TEST(AgradRevMatrix, diagonal_varmat) { stan::math::diagonal(m)); } -TEST(AgradRevMatrix, subsets_varmat) { +TEST_F(AgradRev, RevMatrix_subsets_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -60,7 +61,7 @@ TEST(AgradRevMatrix, subsets_varmat) { stan::math::sub_col(m, 1, 1, 2)); } -TEST(AgradRevMatrix, transpose_varmat) { +TEST_F(AgradRev, RevMatrix_transpose_varmat) { using stan::math::var_value; Eigen::MatrixXd m(2, 3); m << 0, 1, 2, 3, 4, 5; @@ -70,7 +71,7 @@ TEST(AgradRevMatrix, transpose_varmat) { stan::math::transpose(m)); } -TEST(AgradRevMatrix, head_varmat) { +TEST_F(AgradRev, RevMatrix_head_varmat) { using stan::math::var_value; Eigen::VectorXd vec(6); vec << 0, 1, 2, 3, 4, 5; @@ -80,7 +81,7 @@ TEST(AgradRevMatrix, head_varmat) { stan::math::head(vec, 2)); } -TEST(AgradRevMatrix, tail_varmat) { +TEST_F(AgradRev, RevMatrix_tail_varmat) { using stan::math::var_value; Eigen::VectorXd vec(6); vec << 0, 1, 2, 3, 4, 5; @@ -90,7 +91,7 @@ TEST(AgradRevMatrix, tail_varmat) { stan::math::tail(vec, 2)); } -TEST(AgradRevMatrix, reverse_varmat) { +TEST_F(AgradRev, RevMatrix_reverse_varmat) { using stan::math::var_value; Eigen::VectorXd vec(6); vec << 0, 1, 2, 3, 4, 5; @@ -100,7 +101,7 @@ TEST(AgradRevMatrix, reverse_varmat) { stan::math::reverse(vec)); } -TEST(AgradRevMatrix, segment_varmat) { +TEST_F(AgradRev, RevMatrix_segment_varmat) { using stan::math::var_value; Eigen::VectorXd vec(6); vec << 0, 1, 2, 3, 4, 5; diff --git a/test/unit/math/rev/fun/eigenvalues_sym_test.cpp b/test/unit/math/rev/fun/eigenvalues_sym_test.cpp index 1399a2d9c73..740756708fc 100644 --- a/test/unit/math/rev/fun/eigenvalues_sym_test.cpp +++ b/test/unit/math/rev/fun/eigenvalues_sym_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(AgradRev, eigenvaluesSymLogDet) { +TEST_F(AgradRev, Rev_eigenvaluesSymLogDet) { // logdet(A) can be calculated using eigenvalues of matrix A // the derivative of logdet(A) should be inverse(A) // See stan-dev/math/issues/1803 diff --git a/test/unit/math/rev/fun/eigenvectors_sym_test.cpp b/test/unit/math/rev/fun/eigenvectors_sym_test.cpp index 46428343934..a93aac0bc5d 100644 --- a/test/unit/math/rev/fun/eigenvectors_sym_test.cpp +++ b/test/unit/math/rev/fun/eigenvectors_sym_test.cpp @@ -1,11 +1,12 @@ #include +#include #include #include #include #include #include -TEST(AgradRev, eigenvectorsSym) { +TEST_F(AgradRev, Rev_eigenvectorsSym) { Eigen::MatrixXd a(4, 4); // Random symmetric matrix a << 1.8904, 0.7204, -0.1599, 1.2028, 0.7204, 7.3394, 2.0895, -0.6151, diff --git a/test/unit/math/rev/fun/fill_test.cpp b/test/unit/math/rev/fun/fill_test.cpp index 7dae163c0f7..18cdbf10d0e 100644 --- a/test/unit/math/rev/fun/fill_test.cpp +++ b/test/unit/math/rev/fun/fill_test.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include diff --git a/test/unit/math/rev/fun/from_var_value_test.cpp b/test/unit/math/rev/fun/from_var_value_test.cpp index 978ae2569cf..3980de6649e 100644 --- a/test/unit/math/rev/fun/from_var_value_test.cpp +++ b/test/unit/math/rev/fun/from_var_value_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevMatrix, from_var_value_types) { +TEST_F(AgradRev, RevMatrix_from_var_value_types) { using stan::math::from_var_value; using stan::math::var; using stan::math::var_value; @@ -58,7 +59,7 @@ TEST(AgradRevMatrix, from_var_value_types) { stan::math::recover_memory(); } -TEST(AgradRevMatrix, from_var_value_vec_types) { +TEST_F(AgradRev, RevMatrix_from_var_value_vec_types) { using stan::math::from_var_value; using stan::math::var; using stan::math::var_value; @@ -104,7 +105,7 @@ TEST(AgradRevMatrix, from_var_value_vec_types) { stan::math::recover_memory(); } -TEST(AgradRevMatrix, from_var_value_matrix_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_matrix_test) { Eigen::MatrixXd val(2, 3); val << 1, 2, 3, 4, 5, 6; Eigen::MatrixXd adj(2, 3); @@ -118,7 +119,7 @@ TEST(AgradRevMatrix, from_var_value_matrix_test) { EXPECT_MATRIX_EQ(var_value.adj(), adj); } -TEST(AgradRevMatrix, from_var_value_vector_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_vector_test) { Eigen::VectorXd val(3); val << 1, 2, 3; Eigen::VectorXd adj(3); @@ -132,7 +133,7 @@ TEST(AgradRevMatrix, from_var_value_vector_test) { EXPECT_MATRIX_EQ(var_value.adj(), adj); } -TEST(AgradRevMatrix, from_var_value_row_vector_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_row_vector_test) { Eigen::RowVectorXd val(3); val << 1, 2, 3; Eigen::RowVectorXd adj(3); @@ -146,7 +147,7 @@ TEST(AgradRevMatrix, from_var_value_row_vector_test) { EXPECT_MATRIX_EQ(var_value.adj(), adj); } -TEST(AgradRevMatrix, from_var_value_matrix_svec_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_matrix_svec_test) { std::vector> varmats; @@ -165,7 +166,7 @@ TEST(AgradRevMatrix, from_var_value_matrix_svec_test) { } } -TEST(AgradRevMatrix, from_var_value_vector_svec_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_vector_svec_test) { std::vector> varmats; @@ -184,7 +185,7 @@ TEST(AgradRevMatrix, from_var_value_vector_svec_test) { } } -TEST(AgradRevMatrix, from_var_value_row_vector_svec_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_row_vector_svec_test) { std::vector> varmats; @@ -203,7 +204,7 @@ TEST(AgradRevMatrix, from_var_value_row_vector_svec_test) { } } -TEST(AgradRevMatrix, from_var_value_prim_test) { +TEST_F(AgradRev, RevMatrix_from_var_value_prim_test) { Eigen::MatrixXd a(3, 2); a << 1, 2, 3, 4, 5, 6; Eigen::VectorXd b(3); diff --git a/test/unit/math/rev/fun/get_lp_test.cpp b/test/unit/math/rev/fun/get_lp_test.cpp index 5b42e93e69a..eed3ef7105a 100644 --- a/test/unit/math/rev/fun/get_lp_test.cpp +++ b/test/unit/math/rev/fun/get_lp_test.cpp @@ -1,8 +1,8 @@ #include -#include #include +#include -TEST(MathMatrixRevMat, getLp) { +TEST_F(AgradRev, MathMatrixRevMat_getLp) { using stan::math::accumulator; using stan::math::get_lp; using stan::math::var; @@ -16,7 +16,7 @@ TEST(MathMatrixRevMat, getLp) { EXPECT_FLOAT_EQ(17.5, get_lp(lp, lp_accum).val()); } -TEST(AgradRevMatrix, get_lp_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_get_lp_check_varis_on_stack) { using stan::math::accumulator; using stan::math::get_lp; using stan::math::var; diff --git a/test/unit/math/rev/fun/gp_exp_quad_cov_test.cpp b/test/unit/math/rev/fun/gp_exp_quad_cov_test.cpp index 7d577592d2b..81fdea2cb1f 100644 --- a/test/unit/math/rev/fun/gp_exp_quad_cov_test.cpp +++ b/test/unit/math/rev/fun/gp_exp_quad_cov_test.cpp @@ -1,12 +1,12 @@ #include -#include #include #include +#include #include #include #include -TEST(RevMath, gp_exp_quad_cov_vvv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vvv) { Eigen::Matrix cov; for (std::size_t i = 0; i < 3; ++i) { @@ -54,7 +54,7 @@ TEST(RevMath, gp_exp_quad_cov_vvv) { } } -TEST(RevMath, gp_exp_quad_cov_vvd) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vvd) { Eigen::Matrix cov; double l = 5; @@ -98,7 +98,7 @@ TEST(RevMath, gp_exp_quad_cov_vvd) { } } -TEST(RevMath, gp_exp_quad_cov_vdv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vdv) { Eigen::Matrix cov; double sigma = 0.2; @@ -139,7 +139,7 @@ TEST(RevMath, gp_exp_quad_cov_vdv) { } } -TEST(RevMath, gp_exp_quad_cov_vdd) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vdd) { Eigen::Matrix cov; double sigma = 0.2; double l = 5; @@ -176,7 +176,7 @@ TEST(RevMath, gp_exp_quad_cov_vdd) { } } -TEST(RevMath, gp_exp_quad_cov_dvv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_dvv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -216,7 +216,7 @@ TEST(RevMath, gp_exp_quad_cov_dvv) { } } -TEST(RevMath, gp_exp_quad_cov_dvd) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_dvd) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -251,7 +251,7 @@ TEST(RevMath, gp_exp_quad_cov_dvd) { } } -TEST(RevMath, gp_exp_quad_cov_ddv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_ddv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -285,7 +285,7 @@ TEST(RevMath, gp_exp_quad_cov_ddv) { } } -TEST(RevMath, gp_exp_quad_cov_vector_vvv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_vvv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; @@ -352,7 +352,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_vvv) { } } -TEST(RevMath, gp_exp_quad_cov_vector_vvd) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_vvd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double l = 5; @@ -414,7 +414,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_vvd) { } } -TEST(RevMath, gp_exp_quad_cov_vector_vdv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_vdv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -476,7 +476,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_vdv) { } } -TEST(RevMath, gp_exp_quad_cov_vector_vdd) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_vdd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -533,7 +533,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_vdd) { } } -TEST(RevMath, gp_exp_quad_cov_vector_dvv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_dvv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -603,7 +603,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_dvv) { } } -TEST(RevMath, gp_exp_quad_cov_vector_dvd) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_dvd) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; std::vector x(3); @@ -648,7 +648,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_dvd) { } } -TEST(RevMath, gp_exp_quad_cov_vector_ddv) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_vector_ddv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; std::vector x(3); @@ -693,7 +693,7 @@ TEST(RevMath, gp_exp_quad_cov_vector_ddv) { } } -TEST(RevMath, gp_exp_quad_cov1_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov1_vec_eigen_rvec) { using stan::math::squared_distance; using stan::math::var; @@ -720,7 +720,7 @@ TEST(RevMath, gp_exp_quad_cov1_vec_eigen_rvec) { << "index: (" << i << ", " << j << ")"; } -TEST(RevMath, gp_exp_quad_cov2_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov2_vec_eigen_rvec) { using stan::math::squared_distance; using stan::math::var; var sigma = 0.2; @@ -766,7 +766,7 @@ TEST(RevMath, gp_exp_quad_cov2_vec_eigen_rvec) { } } -TEST(RevMath, gp_exp_quad_cov2_vec_eigen_mixed) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov2_vec_eigen_mixed) { using stan::math::squared_distance; using stan::math::var; var sigma = 0.2; @@ -910,7 +910,7 @@ TEST(RevMath, gp_exp_quad_cov2_vec_eigen_mixed) { } } -TEST(RevMath, gp_exp_quad_cov_domain_error_training) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_domain_error_training) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -957,7 +957,7 @@ TEST(RevMath, gp_exp_quad_cov_domain_error_training) { std::domain_error); } -TEST(RevMath, gp_exp_quad_cov_nan_error_training) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_nan_error_training) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1038,7 +1038,7 @@ TEST(RevMath, gp_exp_quad_cov_nan_error_training) { std::domain_error); } -TEST(RevMath, gp_exp_quad_cov_domain_error) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov_domain_error) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1118,7 +1118,7 @@ TEST(RevMath, gp_exp_quad_cov_domain_error) { std::domain_error); } -TEST(RevMath, gp_exp_quad_cov2_nan_domain_error) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov2_nan_domain_error) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1248,7 +1248,7 @@ TEST(RevMath, gp_exp_quad_cov2_nan_domain_error) { std::domain_error); } -TEST(RevMath, gp_exp_quad_cov2_dim_mismatch_vec_eigen_vec) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov2_dim_mismatch_vec_eigen_vec) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1269,7 +1269,7 @@ TEST(RevMath, gp_exp_quad_cov2_dim_mismatch_vec_eigen_vec) { std::invalid_argument); } -TEST(RevMath, gp_exp_quad_cov2_dim_mismatch_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov2_dim_mismatch_vec_eigen_rvec) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1290,7 +1290,7 @@ TEST(RevMath, gp_exp_quad_cov2_dim_mismatch_vec_eigen_rvec) { std::invalid_argument); } -TEST(RevMath, gp_exp_quad_cov2_dim_mismatch_vec_eigen_mixed) { +TEST_F(AgradRev, RevMath_gp_exp_quad_cov2_dim_mismatch_vec_eigen_mixed) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -1329,7 +1329,7 @@ TEST(RevMath, gp_exp_quad_cov2_dim_mismatch_vec_eigen_mixed) { EXPECT_THROW(stan::math::gp_exp_quad_cov(x_vec_2, x_rvec_2, sigma, l), std::invalid_argument); } -TEST(AgradRevMatrix, gp_exp_quad_cov_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_gp_exp_quad_cov_check_varis_on_stack) { using stan::math::to_var; std::vector x(3); double sigma = 0.2; diff --git a/test/unit/math/rev/fun/gp_periodic_cov_test.cpp b/test/unit/math/rev/fun/gp_periodic_cov_test.cpp index 383b16ebd35..992e55671a0 100644 --- a/test/unit/math/rev/fun/gp_periodic_cov_test.cpp +++ b/test/unit/math/rev/fun/gp_periodic_cov_test.cpp @@ -6,7 +6,7 @@ #include #include -TEST(RevMath, gp_periodic_cov_vvvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vvvv) { Eigen::Matrix cov; for (std::size_t i = 0; i < 3; ++i) { @@ -80,7 +80,7 @@ TEST(RevMath, gp_periodic_cov_vvvv) { } } -TEST(RevMath, gp_periodic_cov_vvvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vvvd) { Eigen::Matrix cov; double p = 7; @@ -134,7 +134,7 @@ TEST(RevMath, gp_periodic_cov_vvvd) { } } -TEST(RevMath, gp_periodic_cov_vvdv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vvdv) { Eigen::Matrix cov; double l = 5; @@ -189,7 +189,7 @@ TEST(RevMath, gp_periodic_cov_vvdv) { } } -TEST(RevMath, gp_periodic_cov_vdvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vdvv) { Eigen::Matrix cov; double sigma = 0.2; @@ -244,7 +244,7 @@ TEST(RevMath, gp_periodic_cov_vdvv) { } } -TEST(RevMath, gp_periodic_cov_vvdd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vvdd) { Eigen::Matrix cov; double l = 5; @@ -293,7 +293,7 @@ TEST(RevMath, gp_periodic_cov_vvdd) { } } -TEST(RevMath, gp_periodic_cov_vdvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vdvd) { Eigen::Matrix cov; double sigma = 0.2; @@ -342,7 +342,7 @@ TEST(RevMath, gp_periodic_cov_vdvd) { } } -TEST(RevMath, gp_periodic_cov_vddv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vddv) { Eigen::Matrix cov; double sigma = 0.2; @@ -392,7 +392,7 @@ TEST(RevMath, gp_periodic_cov_vddv) { } } -TEST(RevMath, gp_periodic_cov_vddd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vddd) { Eigen::Matrix cov; double sigma = 0.2; double l = 5; @@ -436,7 +436,7 @@ TEST(RevMath, gp_periodic_cov_vddd) { } } -TEST(RevMath, gp_periodic_cov_dvvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_dvvv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -485,7 +485,7 @@ TEST(RevMath, gp_periodic_cov_dvvv) { } } -TEST(RevMath, gp_periodic_cov_dvvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_dvvd) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -527,7 +527,7 @@ TEST(RevMath, gp_periodic_cov_dvvd) { } } ////////////////////////////////////////////////////// -TEST(RevMath, gp_periodic_cov_dvdv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_dvdv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -571,7 +571,7 @@ TEST(RevMath, gp_periodic_cov_dvdv) { } } -TEST(RevMath, gp_periodic_cov_ddvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_ddvv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -631,7 +631,7 @@ TEST(RevMath, gp_periodic_cov_ddvv) { } } -TEST(RevMath, gp_periodic_cov_ddvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_ddvd) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -669,7 +669,7 @@ TEST(RevMath, gp_periodic_cov_ddvd) { } } -TEST(RevMath, gp_periodic_cov_dddv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_dddv) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -709,7 +709,7 @@ TEST(RevMath, gp_periodic_cov_dddv) { } } -TEST(RevMath, gp_periodic_cov_dvdd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_dvdd) { Eigen::Matrix cov; std::vector x(3); x[0] = -2; @@ -746,7 +746,7 @@ TEST(RevMath, gp_periodic_cov_dvdd) { } } -TEST(RevMath, gp_periodic_cov_vector_vvvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vvvv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; @@ -837,7 +837,7 @@ TEST(RevMath, gp_periodic_cov_vector_vvvv) { } //////////////////////////////////////////////////////////////////////////// -TEST(RevMath, gp_periodic_cov_vector_vvvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vvvd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; @@ -921,7 +921,7 @@ TEST(RevMath, gp_periodic_cov_vector_vvvd) { } } -TEST(RevMath, gp_periodic_cov_vector_vvdv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vvdv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double l = 5; @@ -1006,7 +1006,7 @@ TEST(RevMath, gp_periodic_cov_vector_vvdv) { } } -TEST(RevMath, gp_periodic_cov_vector_vdvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vdvv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -1092,7 +1092,7 @@ TEST(RevMath, gp_periodic_cov_vector_vdvv) { } } -TEST(RevMath, gp_periodic_cov_vector_vvdd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vvdd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double l = 5; @@ -1171,7 +1171,7 @@ TEST(RevMath, gp_periodic_cov_vector_vvdd) { } } -TEST(RevMath, gp_periodic_cov_vector_vdvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vdvd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -1251,7 +1251,7 @@ TEST(RevMath, gp_periodic_cov_vector_vdvd) { } } -TEST(RevMath, gp_periodic_cov_vector_vddv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vddv) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -1332,7 +1332,7 @@ TEST(RevMath, gp_periodic_cov_vector_vddv) { } } -TEST(RevMath, gp_periodic_cov_vector_vddd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_vddd) { typedef Eigen::Matrix vector_v; Eigen::Matrix cov; double sigma = 0.2; @@ -1406,7 +1406,7 @@ TEST(RevMath, gp_periodic_cov_vector_vddd) { } } -TEST(RevMath, gp_periodic_cov_vector_dvvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_dvvv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1466,7 +1466,7 @@ TEST(RevMath, gp_periodic_cov_vector_dvvv) { } } -TEST(RevMath, gp_periodic_cov_vector_dvvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_dvvd) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1519,7 +1519,7 @@ TEST(RevMath, gp_periodic_cov_vector_dvvd) { } } -TEST(RevMath, gp_periodic_cov_vector_dvdv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_dvdv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1574,7 +1574,7 @@ TEST(RevMath, gp_periodic_cov_vector_dvdv) { } } -TEST(RevMath, gp_periodic_cov_vector_ddvv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_ddvv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1630,7 +1630,7 @@ TEST(RevMath, gp_periodic_cov_vector_ddvv) { } } -TEST(RevMath, gp_periodic_cov_vector_dvdd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_dvdd) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1679,7 +1679,7 @@ TEST(RevMath, gp_periodic_cov_vector_dvdd) { } } -TEST(RevMath, gp_periodic_cov_vector_ddvd) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_ddvd) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1728,7 +1728,7 @@ TEST(RevMath, gp_periodic_cov_vector_ddvd) { } } -TEST(RevMath, gp_periodic_cov_vector_dddv) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_vector_dddv) { typedef Eigen::Matrix vector_d; Eigen::Matrix cov; @@ -1779,7 +1779,7 @@ TEST(RevMath, gp_periodic_cov_vector_dddv) { } } -TEST(RevMath, gp_periodic_cov1_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_gp_periodic_cov1_vec_eigen_rvec) { using stan::math::squared_distance; using stan::math::var; @@ -1812,7 +1812,7 @@ TEST(RevMath, gp_periodic_cov1_vec_eigen_rvec) { } } -TEST(RevMath, gp_periodic_cov2_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_gp_periodic_cov2_vec_eigen_rvec) { using stan::math::squared_distance; using stan::math::var; var sigma = 0.2; @@ -1868,7 +1868,7 @@ TEST(RevMath, gp_periodic_cov2_vec_eigen_rvec) { } } -TEST(RevMath, gp_periodic_cov2_vec_eigen_mixed) { +TEST_F(AgradRev, RevMath_gp_periodic_cov2_vec_eigen_mixed) { using stan::math::squared_distance; using stan::math::var; var sigma = 0.2; @@ -2046,7 +2046,7 @@ TEST(RevMath, gp_periodic_cov2_vec_eigen_mixed) { } } -TEST(RevMath, gp_periodic_cov_domain_error_training) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_domain_error_training) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2119,7 +2119,7 @@ TEST(RevMath, gp_periodic_cov_domain_error_training) { std::domain_error); } -TEST(RevMath, gp_periodic_cov_nan_error_training) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_nan_error_training) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2250,7 +2250,7 @@ TEST(RevMath, gp_periodic_cov_nan_error_training) { std::domain_error); } -TEST(RevMath, gp_periodic_cov_domain_error) { +TEST_F(AgradRev, RevMath_gp_periodic_cov_domain_error) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2387,7 +2387,7 @@ TEST(RevMath, gp_periodic_cov_domain_error) { std::domain_error); } -TEST(RevMath, gp_periodic_cov2_nan_domain_error) { +TEST_F(AgradRev, RevMath_gp_periodic_cov2_nan_domain_error) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2577,7 +2577,7 @@ TEST(RevMath, gp_periodic_cov2_nan_domain_error) { std::domain_error); } -TEST(RevMath, gp_periodic_cov2_dim_mismatch_vec_eigen_vec) { +TEST_F(AgradRev, RevMath_gp_periodic_cov2_dim_mismatch_vec_eigen_vec) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2599,7 +2599,7 @@ TEST(RevMath, gp_periodic_cov2_dim_mismatch_vec_eigen_vec) { std::invalid_argument); } -TEST(RevMath, gp_periodic_cov2_dim_mismatch_vec_eigen_rvec) { +TEST_F(AgradRev, RevMath_gp_periodic_cov2_dim_mismatch_vec_eigen_rvec) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2621,7 +2621,7 @@ TEST(RevMath, gp_periodic_cov2_dim_mismatch_vec_eigen_rvec) { std::invalid_argument); } -TEST(RevMath, gp_periodic_cov2_dim_mismatch_vec_eigen_mixed) { +TEST_F(AgradRev, RevMath_gp_periodic_cov2_dim_mismatch_vec_eigen_mixed) { using stan::math::var; var sigma = 0.2; var l = 5; @@ -2662,7 +2662,7 @@ TEST(RevMath, gp_periodic_cov2_dim_mismatch_vec_eigen_mixed) { std::invalid_argument); } -TEST(AgradRevMatrix, gp_periodic_cov_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_gp_periodic_cov_check_varis_on_stack) { using stan::math::to_var; std::vector x(3); double sigma = 0.2; diff --git a/test/unit/math/rev/fun/if_else_test.cpp b/test/unit/math/rev/fun/if_else_test.cpp index 93e8a97120f..89d35ad9723 100644 --- a/test/unit/math/rev/fun/if_else_test.cpp +++ b/test/unit/math/rev/fun/if_else_test.cpp @@ -1,10 +1,10 @@ #include -#include #include +#include #include #include -TEST(AgradRev, if_else) { +TEST_F(AgradRev, Rev_if_else) { using stan::math::if_else; using stan::math::var; @@ -18,7 +18,7 @@ TEST(AgradRev, if_else) { EXPECT_FLOAT_EQ(2.0, if_else(false, var(1.0), 2.0).val()); } -TEST(AgradRev, if_else_nan) { +TEST_F(AgradRev, Rev_if_else_nan) { using stan::math::if_else; double nan = std::numeric_limits::quiet_NaN(); @@ -49,7 +49,7 @@ TEST(AgradRev, if_else_nan) { EXPECT_TRUE(std::isnan(if_else(false, nan_v, nan_v).val())); } -TEST(AgradRev, if_else_check_varis_on_stack) { +TEST_F(AgradRev, Rev_if_else_check_varis_on_stack) { stan::math::var x = 1.0; stan::math::var y = 2.0; test::check_varis_on_stack(stan::math::if_else(true, x, y)); diff --git a/test/unit/math/rev/fun/initialize_fill_test.cpp b/test/unit/math/rev/fun/initialize_fill_test.cpp index caaf9bcbc88..4cc4116a088 100644 --- a/test/unit/math/rev/fun/initialize_fill_test.cpp +++ b/test/unit/math/rev/fun/initialize_fill_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevMatrix, initialize_fill) { +TEST_F(AgradRev, RevMatrix_initialize_fill) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::initialize_fill; @@ -43,7 +44,7 @@ TEST(AgradRevMatrix, initialize_fill) { for (size_t j = 0; j < 2; ++j) EXPECT_FLOAT_EQ(54, d[i][j].val()); } -TEST(AgradRevMatrix, initialize_fillDouble) { +TEST_F(AgradRev, RevMatrix_initialize_fillDouble) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::initialize_fill; @@ -53,7 +54,7 @@ TEST(AgradRevMatrix, initialize_fillDouble) { EXPECT_FLOAT_EQ(3.0, y[0]); } -TEST(AgradRevMatrix, initialize_fillVarMatDouble) { +TEST_F(AgradRev, RevMatrix_initialize_fillVarMatDouble) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::initialize_fill; @@ -71,7 +72,7 @@ TEST(AgradRevMatrix, initialize_fillVarMatDouble) { } } -TEST(AgradRevMatrix, initialize_fillVarMatVar) { +TEST_F(AgradRev, RevMatrix_initialize_fillVarMatVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::initialize_fill; diff --git a/test/unit/math/rev/fun/initialize_test.cpp b/test/unit/math/rev/fun/initialize_test.cpp index bdedeab7875..b6e557ad704 100644 --- a/test/unit/math/rev/fun/initialize_test.cpp +++ b/test/unit/math/rev/fun/initialize_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(MathMatrixRevMat, initializeVar) { +TEST_F(AgradRev, MathMatrixRevMat_initializeVar) { using stan::math::initialize; using stan::math::var; var a; @@ -16,7 +17,7 @@ TEST(MathMatrixRevMat, initializeVar) { EXPECT_FLOAT_EQ(13.2, a.val()); } -TEST(MathMatrixRevMat, initMatrix) { +TEST_F(AgradRev, MathMatrixRevMat_initMatrix) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::initialize; diff --git a/test/unit/math/rev/fun/initialize_variable_test.cpp b/test/unit/math/rev/fun/initialize_variable_test.cpp index 26e5d332f77..2284851c96b 100644 --- a/test/unit/math/rev/fun/initialize_variable_test.cpp +++ b/test/unit/math/rev/fun/initialize_variable_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevMatrix, initializeVariable) { +TEST_F(AgradRev, RevMatrix_initializeVariable) { using stan::math::initialize_variable; using std::vector; diff --git a/test/unit/math/rev/fun/int_step_test.cpp b/test/unit/math/rev/fun/int_step_test.cpp index d78dd41f406..c5a49ac620e 100644 --- a/test/unit/math/rev/fun/int_step_test.cpp +++ b/test/unit/math/rev/fun/int_step_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRev, int_step) { +TEST_F(AgradRev, Rev_int_step) { using stan::math::int_step; stan::math::var a(5.0); diff --git a/test/unit/math/rev/fun/inv_inc_beta_test.cpp b/test/unit/math/rev/fun/inv_inc_beta_test.cpp index 9f485a78e9c..41c51bd2a2f 100644 --- a/test/unit/math/rev/fun/inv_inc_beta_test.cpp +++ b/test/unit/math/rev/fun/inv_inc_beta_test.cpp @@ -1,9 +1,9 @@ #include -#include -#include #include +#include +#include -TEST(inv_inc_beta, values) { +TEST_F(AgradRev, inv_inc_beta_values) { using stan::math::inv_inc_beta; using stan::math::var; diff --git a/test/unit/math/rev/fun/is_any_nan_test.cpp b/test/unit/math/rev/fun/is_any_nan_test.cpp index 7cb7f2ccf29..e3b2a0ea7c9 100644 --- a/test/unit/math/rev/fun/is_any_nan_test.cpp +++ b/test/unit/math/rev/fun/is_any_nan_test.cpp @@ -1,10 +1,10 @@ #include -#include -#include #include +#include +#include #include -TEST(MathFunctions, is_any_nan_variadic_rev) { +TEST_F(AgradRev, MathFunctions_is_any_nan_variadic_rev) { using stan::math::is_any_nan; double dbl_inf = std::numeric_limits::infinity(); diff --git a/test/unit/math/rev/fun/is_inf_test.cpp b/test/unit/math/rev/fun/is_inf_test.cpp index 8def2e41472..c73d1d75467 100644 --- a/test/unit/math/rev/fun/is_inf_test.cpp +++ b/test/unit/math/rev/fun/is_inf_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRev, is_inf) { +TEST_F(AgradRev, Rev_is_inf) { using stan::math::is_inf; double infinity = std::numeric_limits::infinity(); diff --git a/test/unit/math/rev/fun/is_nan_test.cpp b/test/unit/math/rev/fun/is_nan_test.cpp index 176dc895330..5c3a1f97679 100644 --- a/test/unit/math/rev/fun/is_nan_test.cpp +++ b/test/unit/math/rev/fun/is_nan_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRev, is_nan) { +TEST_F(AgradRev, Rev_is_nan) { using stan::math::is_nan; double infinity = std::numeric_limits::infinity(); diff --git a/test/unit/math/rev/fun/is_uninitialized_test.cpp b/test/unit/math/rev/fun/is_uninitialized_test.cpp index 08e54f1c88d..e3337ff23ac 100644 --- a/test/unit/math/rev/fun/is_uninitialized_test.cpp +++ b/test/unit/math/rev/fun/is_uninitialized_test.cpp @@ -1,15 +1,16 @@ #include +#include #include #include -TEST(AgradRev, undefined) { +TEST_F(AgradRev, Rev_undefined) { stan::math::var a; EXPECT_TRUE(a.is_uninitialized()); a = 5; EXPECT_FALSE(a.is_uninitialized()); } -TEST(AgradRev, is_uninitialized_nan) { +TEST_F(AgradRev, Rev_is_uninitialized_nan) { stan::math::var nan = std::numeric_limits::quiet_NaN(); EXPECT_FALSE(stan::math::is_uninitialized(nan)); diff --git a/test/unit/math/rev/fun/jacobian.hpp b/test/unit/math/rev/fun/jacobian.hpp index 7d8f723c02c..287088a3fd5 100644 --- a/test/unit/math/rev/fun/jacobian.hpp +++ b/test/unit/math/rev/fun/jacobian.hpp @@ -5,6 +5,7 @@ // ********* superseded by version in autodiff.hpp for API **** #include +#include #include namespace stan { diff --git a/test/unit/math/rev/fun/lbeta_test.cpp b/test/unit/math/rev/fun/lbeta_test.cpp index 9a16a585a39..a586bd7b8ab 100644 --- a/test/unit/math/rev/fun/lbeta_test.cpp +++ b/test/unit/math/rev/fun/lbeta_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -59,7 +60,7 @@ void expect_identity(const std::string& msg, } } // namespace lbeta_test_internal -TEST(MathFunctions, lbeta_identities_gradient) { +TEST_F(AgradRev, MathFunctions_lbeta_identities_gradient) { using stan::math::lbeta; using stan::math::pi; using stan::math::var; @@ -246,7 +247,7 @@ std::vector testValues = { }; } // namespace lbeta_test_internal -TEST(MathFunctions, lbeta_precomputed) { +TEST_F(AgradRev, MathFunctions_lbeta_precomputed) { using lbeta_test_internal::TestValue; using lbeta_test_internal::testValues; using stan::math::is_nan; diff --git a/test/unit/math/rev/fun/log_sum_exp_test.cpp b/test/unit/math/rev/fun/log_sum_exp_test.cpp index aa6d49f81a1..f020a0d1dd2 100644 --- a/test/unit/math/rev/fun/log_sum_exp_test.cpp +++ b/test/unit/math/rev/fun/log_sum_exp_test.cpp @@ -1,9 +1,9 @@ #include -#include -#include #include +#include +#include -TEST(log_sum_exp_tests, large_values) { +TEST_F(AgradRev, log_sum_exp_tests_large_values) { using stan::math::var; // check autodiffing works with var types with large values diff --git a/test/unit/math/rev/fun/misc_test.cpp b/test/unit/math/rev/fun/misc_test.cpp index 7e28acde3a5..c7ce3b81926 100644 --- a/test/unit/math/rev/fun/misc_test.cpp +++ b/test/unit/math/rev/fun/misc_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRevMatrix, mv_squaredNorm) { +TEST_F(AgradRev, RevMatrix_mv_squaredNorm) { using stan::math::matrix_v; matrix_v a(2, 2); @@ -21,7 +22,7 @@ TEST(AgradRevMatrix, mv_squaredNorm) { EXPECT_FLOAT_EQ(10.0, g[2]); EXPECT_FLOAT_EQ(20.0, g[3]); } -TEST(AgradRevMatrix, mv_norm) { +TEST_F(AgradRev, RevMatrix_mv_norm) { using stan::math::matrix_v; matrix_v a(2, 1); @@ -38,7 +39,7 @@ TEST(AgradRevMatrix, mv_norm) { EXPECT_FLOAT_EQ(-3.0 / 5.0, g[0]); EXPECT_FLOAT_EQ(4.0 / 5.0, g[1]); } -TEST(AgradRevMatrix, mv_lp_norm) { +TEST_F(AgradRev, RevMatrix_mv_lp_norm) { using stan::math::matrix_v; matrix_v a(2, 2); @@ -57,7 +58,7 @@ TEST(AgradRevMatrix, mv_lp_norm) { // ? depends on impl here, could be -1 or 1 EXPECT_FLOAT_EQ(0.0, g[3]); } -TEST(AgradRevMatrix, mv_lp_norm_inf) { +TEST_F(AgradRev, RevMatrix_mv_lp_norm_inf) { using stan::math::matrix_v; matrix_v a(2, 2); @@ -76,7 +77,7 @@ TEST(AgradRevMatrix, mv_lp_norm_inf) { EXPECT_FLOAT_EQ(0.0, g[3]); } -TEST(AgradRevMatrix, UserCase1) { +TEST_F(AgradRev, RevMatrix_UserCase1) { using stan::math::assign; using stan::math::dot_product; using stan::math::get_base1; diff --git a/test/unit/math/rev/fun/primitive_value_test.cpp b/test/unit/math/rev/fun/primitive_value_test.cpp index dcdf21a02c3..c64772ac409 100644 --- a/test/unit/math/rev/fun/primitive_value_test.cpp +++ b/test/unit/math/rev/fun/primitive_value_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRev, primitiveValue) { +TEST_F(AgradRev, Rev_primitiveValue) { using stan::math::primitive_value; using stan::math::var; diff --git a/test/unit/math/rev/fun/promote_elements_test.cpp b/test/unit/math/rev/fun/promote_elements_test.cpp index 48493ff37ae..c60201fca8e 100644 --- a/test/unit/math/rev/fun/promote_elements_test.cpp +++ b/test/unit/math/rev/fun/promote_elements_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -10,7 +11,7 @@ using stan::math::promote_elements; using stan::math::var; using std::vector; -TEST(MathFunctionsScalPromote_Elements, double2var) { +TEST_F(AgradRev, MathFunctionsScalPromote_Elements_double2var) { double from; promote_elements p; typedef BOOST_TYPEOF(p.promote(from)) result_t; @@ -18,7 +19,7 @@ TEST(MathFunctionsScalPromote_Elements, double2var) { EXPECT_TRUE(same); } -TEST(MathFunctionsArrPromote_Elements, doubleVec2varVec) { +TEST_F(AgradRev, MathFunctionsArrPromote_Elements_doubleVec2varVec) { vector from; from.push_back(1); from.push_back(2); @@ -29,7 +30,7 @@ TEST(MathFunctionsArrPromote_Elements, doubleVec2varVec) { EXPECT_TRUE(same); } -TEST(MathFunctionsMatPromote_Elements, doubleMat2varMat) { +TEST_F(AgradRev, MathFunctionsMatPromote_Elements_doubleMat2varMat) { stan::math::matrix_d m1(2, 3); m1 << 1, 2, 3, 4, 5, 6; promote_elements, Matrix > p; diff --git a/test/unit/math/rev/fun/promote_scalar_test.cpp b/test/unit/math/rev/fun/promote_scalar_test.cpp index 55e368c77bc..9b9c56bfab9 100644 --- a/test/unit/math/rev/fun/promote_scalar_test.cpp +++ b/test/unit/math/rev/fun/promote_scalar_test.cpp @@ -1,11 +1,12 @@ #include +#include #include // there is no agrad-defined version of promote_scalar, so this is // just testing that it works with non-inter-convertible types (double // can be assigned to var, but not vice-versa) -TEST(AgradRevFunctionsPromoteScalar, Mismatch) { +TEST_F(AgradRev, RevFunctionsPromoteScalar_Mismatch) { using stan::math::promote_scalar; using stan::math::var; EXPECT_FLOAT_EQ(2.3, promote_scalar(2.3).val()); diff --git a/test/unit/math/rev/fun/read_var_test.cpp b/test/unit/math/rev/fun/read_var_test.cpp index 2d8e89861c7..c6fe73dd9d6 100644 --- a/test/unit/math/rev/fun/read_var_test.cpp +++ b/test/unit/math/rev/fun/read_var_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevMatrix, read_var_mat) { +TEST_F(AgradRev, RevMatrix_read_var_mat) { using Eigen::MatrixXd; using stan::math::matrix_v; using stan::math::matrix_vi; @@ -48,7 +49,7 @@ TEST(AgradRevMatrix, read_var_mat) { EXPECT_MATRIX_FLOAT_EQ(matrix_var.adj(), matrix_vi3.adj()); } -TEST(AgradRevMatrix, read_var_vec) { +TEST_F(AgradRev, RevMatrix_read_var_vec) { using Eigen::VectorXd; using stan::math::read_val_adj; using stan::math::read_vi_adj; @@ -88,7 +89,7 @@ TEST(AgradRevMatrix, read_var_vec) { EXPECT_MATRIX_FLOAT_EQ(vector_var.adj(), vector_vi3.adj()); } -TEST(AgradRevMatrix, read_var_rowvec) { +TEST_F(AgradRev, RevMatrix_read_var_rowvec) { using Eigen::RowVectorXd; using stan::math::read_val_adj; using stan::math::read_vi_adj; @@ -129,7 +130,7 @@ TEST(AgradRevMatrix, read_var_rowvec) { EXPECT_MATRIX_FLOAT_EQ(row_vector_var.adj(), row_vector_vi3.adj()); } -TEST(AgradRevMatrix, read_var_expr) { +TEST_F(AgradRev, RevMatrix_read_var_expr) { using Eigen::MatrixXd; using Eigen::VectorXd; using stan::math::matrix_v; diff --git a/test/unit/math/rev/fun/rep_matrix_test.cpp b/test/unit/math/rev/fun/rep_matrix_test.cpp index e470616dfe8..0f36a1b01ed 100644 --- a/test/unit/math/rev/fun/rep_matrix_test.cpp +++ b/test/unit/math/rev/fun/rep_matrix_test.cpp @@ -1,13 +1,13 @@ #include -#include #include #include #include +#include #include #include #include -TEST(MathMixMatFun, repMatrixVar) { +TEST_F(AgradRev, MathMixMatFun_repMatrixVar) { using stan::math::rep_matrix; using stan::math::sum; using stan::math::var; @@ -33,7 +33,7 @@ TEST(MathMixMatFun, repMatrixVar) { EXPECT_EQ(x4.cols(), 2); } -TEST(MathMixMatFun, repVarMatrix) { +TEST_F(AgradRev, MathMixMatFun_repVarMatrix) { using stan::math::rep_matrix; using stan::math::sum; using stan::math::var; @@ -49,7 +49,7 @@ TEST(MathMixMatFun, repVarMatrix) { EXPECT_EQ(x_var.adj(), 25.0); } -TEST(MathMixMatFun, repVarMatrixVec) { +TEST_F(AgradRev, MathMixMatFun_repVarMatrixVec) { using stan::math::rep_matrix; using stan::math::sum; using stan::math::var; @@ -67,7 +67,7 @@ TEST(MathMixMatFun, repVarMatrixVec) { EXPECT_MATRIX_EQ(x_var.adj(), expected_x_var_adjs); } -TEST(MathMixMatFun, repVarMatrixRowVec) { +TEST_F(AgradRev, MathMixMatFun_repVarMatrixRowVec) { using stan::math::rep_matrix; using stan::math::sum; using stan::math::var; diff --git a/test/unit/math/rev/fun/rep_row_vector_test.cpp b/test/unit/math/rev/fun/rep_row_vector_test.cpp index 002e63c5afc..bafa613af2e 100644 --- a/test/unit/math/rev/fun/rep_row_vector_test.cpp +++ b/test/unit/math/rev/fun/rep_row_vector_test.cpp @@ -3,7 +3,7 @@ #include #include -TEST(MathMixMatFun, repRowVectorVar) { +TEST_F(AgradRev, MathMixMatFun_repRowVectorVar) { using stan::math::rep_row_vector; using stan::math::sum; using stan::math::var; @@ -20,7 +20,7 @@ TEST(MathMixMatFun, repRowVectorVar) { EXPECT_EQ(x2.cols(), 3); } -TEST(MathMixMatFun, repRowVarVector) { +TEST_F(AgradRev, MathMixMatFun_repRowVarVector) { using stan::math::rep_row_vector; using stan::math::sum; using stan::math::var; diff --git a/test/unit/math/rev/fun/rep_vector_test.cpp b/test/unit/math/rev/fun/rep_vector_test.cpp index bde950b60b2..d1c049174ef 100644 --- a/test/unit/math/rev/fun/rep_vector_test.cpp +++ b/test/unit/math/rev/fun/rep_vector_test.cpp @@ -1,13 +1,13 @@ #include -#include #include #include #include +#include #include #include #include -TEST(MathMixMatFun, repVectorVar) { +TEST_F(AgradRev, MathMixMatFun_repVectorVar) { using stan::math::rep_vector; using stan::math::sum; using stan::math::var; @@ -24,7 +24,7 @@ TEST(MathMixMatFun, repVectorVar) { EXPECT_EQ(x2.cols(), 1); } -TEST(MathMixMatFun, repVarVector) { +TEST_F(AgradRev, MathMixMatFun_repVarVector) { using stan::math::rep_vector; using stan::math::sum; using stan::math::var; diff --git a/test/unit/math/rev/fun/rows_test.cpp b/test/unit/math/rev/fun/rows_test.cpp index d24682b9022..ad2b4348487 100644 --- a/test/unit/math/rev/fun/rows_test.cpp +++ b/test/unit/math/rev/fun/rows_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevMatrix, rows_vector) { +TEST_F(AgradRev, RevMatrix_rows_vector) { using stan::math::row_vector_v; using stan::math::rows; using stan::math::var_value; @@ -17,7 +18,7 @@ TEST(AgradRevMatrix, rows_vector) { vec_v.resize(0); EXPECT_EQ(0U, rows(vec_v)); } -TEST(AgradRevMatrix, rows_rowvector) { +TEST_F(AgradRev, RevMatrix_rows_rowvector) { using stan::math::row_vector_v; using stan::math::rows; using stan::math::var_value; @@ -33,7 +34,7 @@ TEST(AgradRevMatrix, rows_rowvector) { EXPECT_EQ(1U, rows(r_v)); } -TEST(AgradRevMatrix, rows_matrix) { +TEST_F(AgradRev, RevMatrix_rows_matrix) { using stan::math::matrix_v; using stan::math::rows; using stan::math::var_value; diff --git a/test/unit/math/rev/fun/scalar_seq_view_test.cpp b/test/unit/math/rev/fun/scalar_seq_view_test.cpp index 7d8c7686d51..c20b737d310 100644 --- a/test/unit/math/rev/fun/scalar_seq_view_test.cpp +++ b/test/unit/math/rev/fun/scalar_seq_view_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(MathMetaRev, ScalarSeqViewvar) { +TEST_F(AgradRev, MathMetaRev_ScalarSeqViewvar) { using stan::scalar_seq_view; using stan::math::var; var d = 10; @@ -23,7 +24,7 @@ TEST(MathMetaRev, ScalarSeqViewvar) { EXPECT_EQ(1, sv.size()); } -TEST(MathMetaRev, ScalarSeqViewArrayVarVal) { +TEST_F(AgradRev, MathMetaRev_ScalarSeqViewArrayVarVal) { using stan::scalar_seq_view; using stan::math::var; using std::vector; @@ -80,28 +81,28 @@ void expect_scalar_seq_view_adjoints(const C& v) { } } -TEST(MathMetaRev, ScalarSeqViewVectorVar) { +TEST_F(AgradRev, MathMetaRev_ScalarSeqViewVectorVar) { using stan::math::var; Eigen::Matrix A = Eigen::VectorXd::Ones(4); expect_scalar_seq_view_value(A); expect_scalar_seq_view_adjoints(A); } -TEST(MathMetaRev, ScalarSeqViewRowVectorVar) { +TEST_F(AgradRev, MathMetaRev_ScalarSeqViewRowVectorVar) { using stan::math::var; Eigen::Matrix A = Eigen::RowVectorXd::Ones(4); expect_scalar_seq_view_value(A); expect_scalar_seq_view_adjoints(A); } -TEST(MathMetaRev, VarScalarSeqViewVector) { +TEST_F(AgradRev, MathMetaRev_VarScalarSeqViewVector) { using stan::math::var_value; var_value> A = Eigen::VectorXd::Ones(4); expect_scalar_seq_view_value(A); expect_scalar_seq_view_adjoints(A); } -TEST(MathMetaRev, VarScalarSeqViewRowVector) { +TEST_F(AgradRev, MathMetaRev_VarScalarSeqViewRowVector) { using stan::math::var_value; var_value> A = Eigen::RowVectorXd::Ones(4); expect_scalar_seq_view_value(A); diff --git a/test/unit/math/rev/fun/singular_values_test.cpp b/test/unit/math/rev/fun/singular_values_test.cpp index bacf68b3a0b..cdad4a3b9f6 100644 --- a/test/unit/math/rev/fun/singular_values_test.cpp +++ b/test/unit/math/rev/fun/singular_values_test.cpp @@ -1,11 +1,12 @@ #include +#include #include #include #include #include #include -TEST(AgradRev, singularvalues_gradient) { +TEST_F(AgradRev, Rev_singularvalues_gradient) { // logdet(A) can be calculated using singularvalues of matrix A // the derivative of logdet(A) should be inverse(A) diff --git a/test/unit/math/rev/fun/size_mvt_test.cpp b/test/unit/math/rev/fun/size_mvt_test.cpp index f4a7682e0b9..07588f4b6f3 100644 --- a/test/unit/math/rev/fun/size_mvt_test.cpp +++ b/test/unit/math/rev/fun/size_mvt_test.cpp @@ -1,15 +1,16 @@ #include +#include #include #include -TEST(AgradRev, size_mvt_scalar) { +TEST_F(AgradRev, Rev_size_mvt_scalar) { using stan::math::size_mvt; stan::math::var x1; EXPECT_THROW(size_mvt(x1), std::invalid_argument); } -TEST(AgradRev, size_mvt_matrices_vectors) { +TEST_F(AgradRev, Rev_size_mvt_matrices_vectors) { using stan::math::size_mvt; stan::math::var_value x1 = Eigen::MatrixXd(2, 3); diff --git a/test/unit/math/rev/fun/sort_indices_test.cpp b/test/unit/math/rev/fun/sort_indices_test.cpp index 640abf2b30d..42b99f544d3 100644 --- a/test/unit/math/rev/fun/sort_indices_test.cpp +++ b/test/unit/math/rev/fun/sort_indices_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -93,7 +94,7 @@ void test_sort_indices_desc(Eigen::Matrix val) { EXPECT_FALSE(x_sorted.data()[i] == x.data()[j]); } -TEST(AgradRev, sort_indices) { +TEST_F(AgradRev, Rev_sort_indices) { std::vector a; a.push_back(1); a.push_back(2); @@ -149,7 +150,7 @@ TEST(AgradRev, sort_indices) { test_sort_indices_desc(vec6); } -TEST(AgradRev, sort_indices_no_thrown) { +TEST_F(AgradRev, Rev_sort_indices_no_thrown) { using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; diff --git a/test/unit/math/rev/fun/stan_print_test.cpp b/test/unit/math/rev/fun/stan_print_test.cpp index 8a55878cd60..da0f0e6691b 100644 --- a/test/unit/math/rev/fun/stan_print_test.cpp +++ b/test/unit/math/rev/fun/stan_print_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRev, stan_print) { +TEST_F(AgradRev, Rev_stan_print) { using stan::math::var; var a = 5.0; diff --git a/test/unit/math/rev/fun/stored_gradient_vari_test.cpp b/test/unit/math/rev/fun/stored_gradient_vari_test.cpp index b6606c4841d..37b059dce41 100644 --- a/test/unit/math/rev/fun/stored_gradient_vari_test.cpp +++ b/test/unit/math/rev/fun/stored_gradient_vari_test.cpp @@ -1,9 +1,9 @@ #include -#include #include +#include #include -TEST(StoredGradientVari, propagate3) { +TEST_F(AgradRev, StoredGradientVari_propagate3) { using stan::math::var; using stan::math::vari; vari** xs = reinterpret_cast( @@ -43,7 +43,7 @@ TEST(StoredGradientVari, propagate3) { EXPECT_EQ(1000 * 132.7, g[2]); } -TEST(StoredGradientVari, propagate0) { +TEST_F(AgradRev, StoredGradientVari_propagate0) { using stan::math::var; using stan::math::vari; vari** xs = 0; @@ -65,7 +65,7 @@ TEST(StoredGradientVari, propagate0) { for (int i = 0; i < 3; ++i) EXPECT_FLOAT_EQ(0, g[i]); } -TEST(AgradRevMatrix, stored_gradient_vari_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_stored_gradient_vari_check_varis_on_stack) { using stan::math::var; using stan::math::vari; vari** xs = reinterpret_cast( diff --git a/test/unit/math/rev/fun/to_arena_test.cpp b/test/unit/math/rev/fun/to_arena_test.cpp index b36b00fa3bb..de03045d877 100644 --- a/test/unit/math/rev/fun/to_arena_test.cpp +++ b/test/unit/math/rev/fun/to_arena_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradRev, to_arena_scalar_test) { +TEST_F(AgradRev, Rev_to_arena_scalar_test) { int a = 2; auto b = stan::math::to_arena(a); EXPECT_EQ(b, a); @@ -14,7 +15,7 @@ TEST(AgradRev, to_arena_scalar_test) { EXPECT_TRUE((std::is_same::value)); } -TEST(AgradRev, to_arena_std_vector_test) { +TEST_F(AgradRev, Rev_to_arena_std_vector_test) { std::vector a{1, 2}; auto b = stan::math::to_arena(a); ASSERT_EQ(a.size(), b.size()); @@ -28,7 +29,7 @@ TEST(AgradRev, to_arena_std_vector_test) { EXPECT_EQ(b.data(), c.data()); } -TEST(AgradRev, to_arena_col_vector_test) { +TEST_F(AgradRev, Rev_to_arena_col_vector_test) { Eigen::VectorXd a(2); a << 1, 2; auto b = stan::math::to_arena(a); @@ -39,7 +40,7 @@ TEST(AgradRev, to_arena_col_vector_test) { EXPECT_EQ(b.data(), c.data()); } -TEST(AgradRev, to_arena_row_vector_test) { +TEST_F(AgradRev, Rev_to_arena_row_vector_test) { Eigen::RowVectorXd a(2); a << 1, 2; auto b = stan::math::to_arena(a); @@ -50,7 +51,7 @@ TEST(AgradRev, to_arena_row_vector_test) { EXPECT_EQ(b.data(), c.data()); } -TEST(AgradRev, to_arena_matrix_test) { +TEST_F(AgradRev, Rev_to_arena_matrix_test) { Eigen::MatrixXd a(2, 2); a << 1, 2, 3, 4; auto b = stan::math::to_arena(a); diff --git a/test/unit/math/rev/fun/to_var_test.cpp b/test/unit/math/rev/fun/to_var_test.cpp index 2b331492b77..9f3b073ef22 100644 --- a/test/unit/math/rev/fun/to_var_test.cpp +++ b/test/unit/math/rev/fun/to_var_test.cpp @@ -1,9 +1,9 @@ #include -#include -#include #include +#include +#include -TEST(AgradRevMatrix, to_var_scalar) { +TEST_F(AgradRev, RevMatrix_to_var_scalar) { double d = 5.0; stan::math::var v = 5.0; stan::math::var var_x = stan::math::to_var(d); @@ -12,7 +12,7 @@ TEST(AgradRevMatrix, to_var_scalar) { var_x = stan::math::to_var(v); EXPECT_FLOAT_EQ(5.0, var_x.val()); } -TEST(AgradRevMatrix, to_var_matrix) { +TEST_F(AgradRev, RevMatrix_to_var_matrix) { using stan::math::matrix_d; using stan::math::matrix_v; matrix_d m_d(2, 3); @@ -25,7 +25,7 @@ TEST(AgradRevMatrix, to_var_matrix) { for (int jj = 0; jj < 3; jj++) EXPECT_FLOAT_EQ(ii * 3 + jj, m_v(ii, jj).val()); } -TEST(AgradRevMatrix, to_var_vector) { +TEST_F(AgradRev, RevMatrix_to_var_vector) { using stan::math::vector_d; using stan::math::vector_v; @@ -49,7 +49,7 @@ TEST(AgradRevMatrix, to_var_vector) { EXPECT_FLOAT_EQ(4, out(3).val()); EXPECT_FLOAT_EQ(5, out(4).val()); } -TEST(AgradRevMatrix, to_var_rowvector) { +TEST_F(AgradRev, RevMatrix_to_var_rowvector) { using stan::math::row_vector_d; using stan::math::row_vector_v; @@ -75,7 +75,7 @@ TEST(AgradRevMatrix, to_var_rowvector) { EXPECT_FLOAT_EQ(5, output(4).val()); } -TEST(AgradRevMatrix, to_var_check_varis_on_stack) { +TEST_F(AgradRev, RevMatrix_to_var_check_varis_on_stack) { stan::math::matrix_v m(2, 2); m << 1, 2, 3, 4; diff --git a/test/unit/math/rev/fun/to_var_value_test.cpp b/test/unit/math/rev/fun/to_var_value_test.cpp index 2dd6c75efeb..bef9dd1e559 100644 --- a/test/unit/math/rev/fun/to_var_value_test.cpp +++ b/test/unit/math/rev/fun/to_var_value_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(AgradRevMatrix, to_var_value_types) { +TEST_F(AgradRev, RevMatrix_to_var_value_types) { using stan::math::to_var_value; using stan::math::var; using stan::math::var_value; @@ -45,7 +46,7 @@ TEST(AgradRevMatrix, to_var_value_types) { stan::math::recover_memory(); } -TEST(AgradRevMatrix, to_var_value_vec_types) { +TEST_F(AgradRev, RevMatrix_to_var_value_vec_types) { using stan::math::to_var_value; using stan::math::var; using stan::math::var_value; @@ -91,7 +92,7 @@ TEST(AgradRevMatrix, to_var_value_vec_types) { stan::math::recover_memory(); } -TEST(AgradRevMatrix, to_var_value_matrix_test) { +TEST_F(AgradRev, RevMatrix_to_var_value_matrix_test) { Eigen::MatrixXd val(2, 3); val << 1, 2, 3, 4, 5, 6; Eigen::MatrixXd adj(2, 3); @@ -105,7 +106,7 @@ TEST(AgradRevMatrix, to_var_value_matrix_test) { EXPECT_MATRIX_EQ(mat_var.adj(), adj); } -TEST(AgradRevMatrix, to_var_value_vector_test) { +TEST_F(AgradRev, RevMatrix_to_var_value_vector_test) { Eigen::VectorXd val(3); val << 1, 2, 3; Eigen::VectorXd adj(3); @@ -119,7 +120,7 @@ TEST(AgradRevMatrix, to_var_value_vector_test) { EXPECT_MATRIX_EQ(mat_var.adj(), adj); } -TEST(AgradRevMatrix, to_var_value_row_vector_test) { +TEST_F(AgradRev, RevMatrix_to_var_value_row_vector_test) { Eigen::RowVectorXd val(3); val << 1, 2, 3; Eigen::RowVectorXd adj(3); @@ -133,7 +134,7 @@ TEST(AgradRevMatrix, to_var_value_row_vector_test) { EXPECT_MATRIX_EQ(mat_var.adj(), adj); } -TEST(AgradRevMatrix, to_var_value_matrix_svec_test) { +TEST_F(AgradRev, RevMatrix_to_var_value_matrix_svec_test) { std::vector> matvars; @@ -152,7 +153,7 @@ TEST(AgradRevMatrix, to_var_value_matrix_svec_test) { } } -TEST(AgradRevMatrix, to_var_value_vector_svec_test) { +TEST_F(AgradRev, RevMatrix_to_var_value_vector_svec_test) { std::vector> matvars; @@ -171,7 +172,7 @@ TEST(AgradRevMatrix, to_var_value_vector_svec_test) { } } -TEST(AgradRevMatrix, to_var_value_row_vector_svec_test) { +TEST_F(AgradRev, RevMatrix_to_var_value_row_vector_svec_test) { std::vector> matvars; diff --git a/test/unit/math/rev/fun/to_vector_test.cpp b/test/unit/math/rev/fun/to_vector_test.cpp index f8bd6c4a626..ebf60a778fb 100644 --- a/test/unit/math/rev/fun/to_vector_test.cpp +++ b/test/unit/math/rev/fun/to_vector_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include -TEST(MathFunRev, to_vector_var_value) { +TEST_F(AgradRev, MathFunRev_to_vector_var_value) { constexpr Eigen::Index n = 100; Eigen::MatrixXd a_val = Eigen::MatrixXd::Random(n, n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/fun/value_of_rec_test.cpp b/test/unit/math/rev/fun/value_of_rec_test.cpp index a969eac1cd8..2994b751373 100644 --- a/test/unit/math/rev/fun/value_of_rec_test.cpp +++ b/test/unit/math/rev/fun/value_of_rec_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(AgradRev, value_of_rec) { +TEST_F(AgradRev, Rev_value_of_rec) { using stan::math::value_of_rec; using stan::math::var; @@ -13,7 +14,7 @@ TEST(AgradRev, value_of_rec) { EXPECT_FLOAT_EQ(5.0, value_of_rec(v_a)); } -TEST(MathMatrixRevArr, value_of_rec) { +TEST_F(AgradRev, MathMatrixRevArr_value_of_rec) { using stan::math::value_of_rec; using stan::math::var; using std::vector; @@ -41,7 +42,7 @@ TEST(MathMatrixRevArr, value_of_rec) { EXPECT_FLOAT_EQ(a[i].val(), d_a[i]); } -TEST(AgradMatrixRev, value_of_rec) { +TEST_F(AgradRev, MatrixRev_value_of_rec) { using stan::math::value_of_rec; using stan::math::var; using std::vector; @@ -79,7 +80,7 @@ TEST(AgradMatrixRev, value_of_rec) { } } -TEST(AgradMatrixRev, value_of_rec_expression) { +TEST_F(AgradRev, MatrixRev_value_of_rec_expression) { using Eigen::Matrix; using Eigen::MatrixXd; using stan::math::value_of; @@ -91,7 +92,7 @@ TEST(AgradMatrixRev, value_of_rec_expression) { EXPECT_MATRIX_NEAR(res, correct, 1e-10); } -TEST(AgradMatrixRev, value_of_rec_matrix_rvalue) { +TEST_F(AgradRev, MatrixRev_value_of_rec_matrix_rvalue) { using Eigen::Matrix; using Eigen::MatrixXd; using stan::math::value_of; diff --git a/test/unit/math/rev/fun/value_of_test.cpp b/test/unit/math/rev/fun/value_of_test.cpp index d262ca22ef9..6932027ac62 100644 --- a/test/unit/math/rev/fun/value_of_test.cpp +++ b/test/unit/math/rev/fun/value_of_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(AgradRev, value_of) { +TEST_F(AgradRev, Rev_value_of) { using stan::math::value_of; using stan::math::var; @@ -15,7 +16,7 @@ TEST(AgradRev, value_of) { EXPECT_FLOAT_EQ(5.0, value_of(5)); } -TEST(MathMatrixRevArr, value_of) { +TEST_F(AgradRev, MathMatrixRevArr_value_of) { using stan::math::value_of; using stan::math::var; using std::vector; @@ -45,7 +46,7 @@ TEST(MathMatrixRevArr, value_of) { EXPECT_FLOAT_EQ(a[i].val(), d_a[i]); } -TEST(AgradMatrix, value_of) { +TEST_F(AgradRev, Matrix_value_of) { using stan::math::value_of; using stan::math::var; using std::vector; @@ -87,7 +88,7 @@ TEST(AgradMatrix, value_of) { } } -TEST(AgradMatrix, value_of_vector_of_vectors) { +TEST_F(AgradRev, Matrix_value_of_vector_of_vectors) { using stan::math::var; std::vector a(5, 0); const std::vector b(5, 0); @@ -114,7 +115,7 @@ TEST(AgradMatrix, value_of_vector_of_vectors) { } } -TEST(AgradMatrix, value_of_vector_of_eigen) { +TEST_F(AgradRev, Matrix_value_of_vector_of_eigen) { using stan::math::var; Eigen::Matrix a = Eigen::VectorXd::Random(5).template cast(); @@ -149,7 +150,7 @@ TEST(AgradMatrix, value_of_vector_of_eigen) { EXPECT_FLOAT_EQ(vvc[i](j), c(j).val()); } -TEST(AgradMatrix, value_of_expression) { +TEST_F(AgradRev, Matrix_value_of_expression) { using Eigen::Matrix; using Eigen::MatrixXd; using stan::math::value_of; @@ -161,7 +162,7 @@ TEST(AgradMatrix, value_of_expression) { EXPECT_MATRIX_NEAR(res, correct, 1e-10); } -TEST(AgradMatrixRev, value_of_matrix_rvalue) { +TEST_F(AgradRev, MatrixRev_value_of_matrix_rvalue) { using Eigen::Matrix; using Eigen::MatrixXd; using stan::math::value_of; diff --git a/test/unit/math/rev/fun/vector_seq_view_test.cpp b/test/unit/math/rev/fun/vector_seq_view_test.cpp index 17fb4c98580..1ce9c40fefb 100644 --- a/test/unit/math/rev/fun/vector_seq_view_test.cpp +++ b/test/unit/math/rev/fun/vector_seq_view_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -20,7 +21,7 @@ void test_vec_seq_var(const T& m1) { EXPECT_FLOAT_EQ(m1.val()(2), vsv_vec.val(0)[2]); EXPECT_EQ(vsv_vec.size(), 2); } -TEST(MathMetaRev, VectorSeqViewVar) { +TEST_F(AgradRev, MathMetaRev_VectorSeqViewVar) { Eigen::Matrix values = Eigen::Matrix::Random(4); Eigen::Matrix A = values; test_vec_seq_var(A); diff --git a/test/unit/math/rev/functor/algebra_solver_fp_test.cpp b/test/unit/math/rev/functor/algebra_solver_fp_test.cpp index 88a73e338fa..fd31b9da8d4 100644 --- a/test/unit/math/rev/functor/algebra_solver_fp_test.cpp +++ b/test/unit/math/rev/functor/algebra_solver_fp_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/analytical_dae_typed_test.cpp b/test/unit/math/rev/functor/analytical_dae_typed_test.cpp index 9eacdc517fe..8bbbd66e8e7 100644 --- a/test/unit/math/rev/functor/analytical_dae_typed_test.cpp +++ b/test/unit/math/rev/functor/analytical_dae_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/chem_dae_sens_typed_test.cpp b/test/unit/math/rev/functor/chem_dae_sens_typed_test.cpp index 7535d4a321b..49f2aec0de4 100644 --- a/test/unit/math/rev/functor/chem_dae_sens_typed_test.cpp +++ b/test/unit/math/rev/functor/chem_dae_sens_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/chem_dae_typed_test.cpp b/test/unit/math/rev/functor/chem_dae_typed_test.cpp index a6a06219c48..be3b3743604 100644 --- a/test/unit/math/rev/functor/chem_dae_typed_test.cpp +++ b/test/unit/math/rev/functor/chem_dae_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/cos_ode_typed_test.cpp b/test/unit/math/rev/functor/cos_ode_typed_test.cpp index e72f749e277..327842289ee 100644 --- a/test/unit/math/rev/functor/cos_ode_typed_test.cpp +++ b/test/unit/math/rev/functor/cos_ode_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/coupled_mm.hpp b/test/unit/math/rev/functor/coupled_mm.hpp index 49d13a268b7..47c5ba7d68b 100644 --- a/test/unit/math/rev/functor/coupled_mm.hpp +++ b/test/unit/math/rev/functor/coupled_mm.hpp @@ -2,6 +2,8 @@ #define TEST_UNIT_MATH_REV_FUNCTOR_COUPLED_MM_HPP #include +#include +#include #include struct coupled_mm_ode_fun { diff --git a/test/unit/math/rev/functor/coupled_ode_system_test.cpp b/test/unit/math/rev/functor/coupled_ode_system_test.cpp index 5eb63a1037c..f99ddac5da9 100644 --- a/test/unit/math/rev/functor/coupled_ode_system_test.cpp +++ b/test/unit/math/rev/functor/coupled_ode_system_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/cvodes_utils_test.cpp b/test/unit/math/rev/functor/cvodes_utils_test.cpp index feaaf64187a..83c21f8611e 100644 --- a/test/unit/math/rev/functor/cvodes_utils_test.cpp +++ b/test/unit/math/rev/functor/cvodes_utils_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -15,7 +16,7 @@ struct Inverse { } }; -TEST(StanMath, cvodes_error_handler) { +TEST_F(AgradRev, StanMath_cvodes_error_handler) { Eigen::VectorXd y0 = Eigen::VectorXd::Ones(1); int t0 = 0; std::vector ts = {0.45, 1.1}; diff --git a/test/unit/math/rev/functor/degenerated_ode_typed_test.cpp b/test/unit/math/rev/functor/degenerated_ode_typed_test.cpp index c39a96583fa..56b9984182d 100644 --- a/test/unit/math/rev/functor/degenerated_ode_typed_test.cpp +++ b/test/unit/math/rev/functor/degenerated_ode_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/fho_ode_typed_ts_test.cpp b/test/unit/math/rev/functor/fho_ode_typed_ts_test.cpp index f405cad4952..decc7957a70 100644 --- a/test/unit/math/rev/functor/fho_ode_typed_ts_test.cpp +++ b/test/unit/math/rev/functor/fho_ode_typed_ts_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp b/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp index 9cf08b9d5ee..8c33207c40b 100644 --- a/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp +++ b/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -89,7 +90,7 @@ void test_hessian_finite_diff(const std::string& msg, const F& f, EXPECT_NEAR(hess_fx_ad(i), hess_fx(i), 1e-4) << msg; } -TEST(RevFunctor, polynomial) { +TEST_F(AgradRev, RevFunctor_polynomial) { poly f; Matrix x(2); x << 5, 7; @@ -109,7 +110,7 @@ TEST(RevFunctor, polynomial) { EXPECT_FLOAT_EQ(6, hess_fx(1, 1)); } -TEST(RevFunctor, linear_function) { +TEST_F(AgradRev, RevFunctor_linear_function) { linear f; Matrix x(3); x << 5, 7, -1; @@ -130,7 +131,7 @@ TEST(RevFunctor, linear_function) { EXPECT_FLOAT_EQ(0, hess_fx(2, 2)); } -TEST(RevFunctor, exp_diag) { +TEST_F(AgradRev, RevFunctor_exp_diag) { exp_diag f; Matrix x(2); x << 2, -1; @@ -146,7 +147,7 @@ TEST(RevFunctor, exp_diag) { EXPECT_FLOAT_EQ(stan::math::exp(-1), hess_fx(1, 1)); } -TEST(RevFunctor, exp_full) { +TEST_F(AgradRev, RevFunctor_exp_full) { exp_full f; Matrix x(2); x << 1, -3; @@ -162,7 +163,7 @@ TEST(RevFunctor, exp_full) { EXPECT_FLOAT_EQ(stan::math::exp(4), hess_fx(1, 1)); } -TEST(RevFunctor, one_arg) { +TEST_F(AgradRev, RevFunctor_one_arg) { one_arg f; Matrix x(1); x << 8; @@ -175,7 +176,7 @@ TEST(RevFunctor, one_arg) { EXPECT_FLOAT_EQ(6 * 8, hess_fx(0, 0)); } -TEST(RevFunctor, FiniteDiffHessianAuto) { +TEST_F(AgradRev, RevFunctor_FiniteDiffHessianAuto) { auto norm_fun = [](const auto& x) { return stan::math::normal_lpdf(x(0), x(1), x(2)); }; Eigen::VectorXd x(3); diff --git a/test/unit/math/rev/functor/finite_diff_hessian_times_vector_test.cpp b/test/unit/math/rev/functor/finite_diff_hessian_times_vector_test.cpp index d710ab1ab3e..c936d1fb20a 100644 --- a/test/unit/math/rev/functor/finite_diff_hessian_times_vector_test.cpp +++ b/test/unit/math/rev/functor/finite_diff_hessian_times_vector_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -33,7 +34,7 @@ struct fun2 { } }; -TEST(RevFunctor, finiteDiffHessianTimesVector) { +TEST_F(AgradRev, RevFunctor_finiteDiffHessianTimesVector) { using stan::math::internal::finite_diff_hessian_times_vector_auto; fun1 f; @@ -55,7 +56,7 @@ TEST(RevFunctor, finiteDiffHessianTimesVector) { EXPECT_FLOAT_EQ(2 * x(0) * v(0) + 6 * v(1), Hv(1)); } -TEST(RevFunctor, finiteDiffHessianTimesVector2) { +TEST_F(AgradRev, RevFunctor_finiteDiffHessianTimesVector2) { using stan::math::internal::finite_diff_hessian_times_vector_auto; fun2 f; diff --git a/test/unit/math/rev/functor/gradient_test.cpp b/test/unit/math/rev/functor/gradient_test.cpp index d611e4bfab5..9d6c2024e94 100644 --- a/test/unit/math/rev/functor/gradient_test.cpp +++ b/test/unit/math/rev/functor/gradient_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -22,7 +23,7 @@ struct fun1 { } }; -TEST(RevFunctor, gradient) { +TEST_F(AgradRev, RevFunctor_gradient) { fun1 f; Matrix x(2); x << 5, 7; @@ -35,7 +36,7 @@ TEST(RevFunctor, gradient) { EXPECT_FLOAT_EQ(x(0) * x(0) + 3 * 2 * x(1), grad_fx(1)); } -TEST(RevFunctor, gradient_input_rowvector) { +TEST_F(AgradRev, RevFunctor_gradient_input_rowvector) { fun1 f; Matrix x(2); x << 5, 7; @@ -48,7 +49,7 @@ TEST(RevFunctor, gradient_input_rowvector) { EXPECT_FLOAT_EQ(x(0) * x(0) + 3 * 2 * x(1), grad_fx[1]); } -TEST(RevFunctor, gradient_array) { +TEST_F(AgradRev, RevFunctor_gradient_array) { fun1 f; Matrix x(2); x << 5, 7; @@ -62,7 +63,7 @@ TEST(RevFunctor, gradient_array) { } // test threaded AD if enabled -TEST(RevFunctor, gradient_threaded) { +TEST_F(AgradRev, RevFunctor_gradient_threaded) { fun1 f; Matrix x_ref(2); x_ref << 5, 7; @@ -147,7 +148,7 @@ TEST(RevFunctor, gradient_threaded) { } // test threaded AD if enabled -TEST(RevFunctor, gradient_array_threaded) { +TEST_F(AgradRev, RevFunctor_gradient_array_threaded) { fun1 f; Matrix x_ref(2); x_ref << 5, 7; @@ -239,7 +240,7 @@ TEST(RevFunctor, gradient_array_threaded) { // test threaded AD through the Intel TBB whenever threading is used #ifdef STAN_THREADS -TEST(RevFunctor, gradient_threaded_tbb) { +TEST_F(AgradRev, RevFunctor_gradient_threaded_tbb) { fun1 f; Matrix x_ref(2); x_ref << 5, 7; @@ -313,7 +314,7 @@ TEST(RevFunctor, gradient_threaded_tbb) { } } -TEST(RevFunctor, gradient_array_threaded_tbb) { +TEST_F(AgradRev, RevFunctor_gradient_array_threaded_tbb) { fun1 f; Matrix x_ref(2); x_ref << 5, 7; @@ -398,7 +399,7 @@ stan::math::var sum_and_throw(const Matrix& x) { throw std::domain_error("fooey"); } -TEST(RevFunctor, RecoverMemory) { +TEST_F(AgradRev, RevFunctor_RecoverMemory) { using Eigen::VectorXd; for (int i = 0; i < 100000; ++i) { try { @@ -417,7 +418,7 @@ TEST(RevFunctor, RecoverMemory) { 100000); } -TEST(RevFunctor, RecoverMemory_gradient_array) { +TEST_F(AgradRev, RevFunctor_RecoverMemory_gradient_array) { using Eigen::VectorXd; for (int i = 0; i < 100000; ++i) { try { @@ -437,7 +438,7 @@ TEST(RevFunctor, RecoverMemory_gradient_array) { 100000); } -TEST(RevFunctor, gradientBoundaryConds) { +TEST_F(AgradRev, RevFunctor_gradientBoundaryConds) { VectorXd x(5); using stan::math::gradient; x << 1, 2, 3, 4, 5; diff --git a/test/unit/math/rev/functor/idas_system_test.cpp b/test/unit/math/rev/functor/idas_system_test.cpp index 29956534613..bc0c92ee0d1 100644 --- a/test/unit/math/rev/functor/idas_system_test.cpp +++ b/test/unit/math/rev/functor/idas_system_test.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/index_3_dae_typed_test.cpp b/test/unit/math/rev/functor/index_3_dae_typed_test.cpp index ac217bf83e5..8d0ef27f34a 100644 --- a/test/unit/math/rev/functor/index_3_dae_typed_test.cpp +++ b/test/unit/math/rev/functor/index_3_dae_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp index 39349dd9e45..3665dbb7783 100644 --- a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -236,7 +237,7 @@ void test_derivatives(const F &f, double a, double b, } } -TEST(StanMath_integrate_1d_impl_rev, test_integer_arguments) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_test_integer_arguments) { stan::math::var v; std::vector theta = {0.5}; std::vector x_r; @@ -249,7 +250,7 @@ TEST(StanMath_integrate_1d_impl_rev, test_integer_arguments) { theta, x_r, x_i)); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_easy) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_easy) { // Easy integrals using stan::math::var; test_derivatives(f1{}, 0.2, 0.7, {0.75}, {}, {}, @@ -266,7 +267,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_easy) { {0.0}); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_zero_crossing) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing) { // Zero crossing integral + test x_r + vars at endpoints using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, {2.5, 3.0}, @@ -299,7 +300,7 @@ TEST(StanMath_integrate_1d_impl_rev, {5 * pow(0.5, 1.5), 12 * 1.75 * 1.75, 4.0}, -19.06340613646808, 0.0); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_no_param_vars) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_no_param_vars) { // No param vars using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -309,7 +310,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_no_param_vars) { {}, -19.06340613646808, 21.41380852375568); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_left_limit_var) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_left_limit_var) { // No param vars, only left limit var using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -319,7 +320,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_left_limit_var) { {}, -19.06340613646808, 0.0); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_right_limit_var) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_right_limit_var) { // No param vars, only right limit var using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -329,7 +330,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_right_limit_var) { {}, 0.0, 21.41380852375568); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_tricky1) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_tricky1) { // Tricky integral from Boost docs + limit at infinity + no gradients using stan::math::var; test_derivatives(f4{}, 0.0, @@ -337,7 +338,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_tricky1) { {}, {}, {}, 1.772453850905516, {}); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_tricky2) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_tricky2) { // Tricky integral from Boost docs + limit at infinity with gradients using stan::math::var; test_derivatives( @@ -347,14 +348,14 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_tricky2) { -1.772453850905516 * 0.5 / (2 * pow(0.5 * 3.0, 1.5))}); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_tricky3) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_tricky3) { // Tricky integral from Boost docs using stan::math::var; test_derivatives( f6{}, 0.0, 1.0, {0.75}, {}, {}, 0.851926727945904, {0.4814066053874294}); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_zero_crossing2) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing2) { // Zero crossing integral + limit at infinity + var at left limit using stan::math::var; test_derivatives( @@ -363,7 +364,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_zero_crossing2) { std::numeric_limits::quiet_NaN()); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_zero_crossing3) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing3) { // Zero crossing integral + limit at negative infinity + var at right limit using stan::math::var; test_derivatives( @@ -372,7 +373,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_zero_crossing3) { std::numeric_limits::quiet_NaN(), 1808.042414456063); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_indefinite) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_indefinite) { // Both limits at infinity + test x_r/x_i + no gradients using stan::math::var; test_derivatives( @@ -381,7 +382,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_indefinite) { 2.536571480364399, {}); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_endpoint_precision) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_endpoint_precision) { // Various integrals of beta function using stan::math::var; test_derivatives(f11{}, 0.0, 1.0, {0.1, 0.1}, {}, {}, @@ -401,7 +402,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_endpoint_precision) { {-0.01040816326530613, -0.004852607709750566}); } -TEST(StanMath_integrate_1d_impl_rev, TestDerivatives_gaussian) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_gaussian) { // Check Gaussian integrates to 1.0 always using stan::math::var; test_derivatives( @@ -429,7 +430,7 @@ TEST(StanMath_integrate_1d_impl_rev, EXPECT_LT(std::abs(12.0 - b.adj()), 1e-8); } -TEST(StanMath_integrate_1d_impl_rev, TestBeta) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestBeta) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -453,7 +454,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestBeta) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestCauchy) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestCauchy) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -479,7 +480,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestCauchy) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestChiSquare) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestChiSquare) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -502,7 +503,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestChiSquare) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_impl_rev, TestDoubleExponential) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDoubleExponential) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -530,7 +531,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestDoubleExponential) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestExponential) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestExponential) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -553,7 +554,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestExponential) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_impl_rev, TestFrechet) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestFrechet) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -579,7 +580,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestFrechet) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestGamma) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestGamma) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -605,7 +606,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestGamma) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestGumbel) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestGumbel) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -631,7 +632,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestGumbel) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestInvChiSquared) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestInvChiSquared) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -655,7 +656,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestInvChiSquared) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_impl_rev, TestLogistic) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestLogistic) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -681,7 +682,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestLogistic) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestLogNormal) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestLogNormal) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -707,7 +708,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestLogNormal) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestNormal) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestNormal) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -733,7 +734,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestNormal) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestPareto) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestPareto) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -759,7 +760,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestPareto) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestPareto2) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestPareto2) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -787,7 +788,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestPareto2) { EXPECT_FLOAT_EQ(1, 1 + g[2]); } -TEST(StanMath_integrate_1d_impl_rev, TestRayleigh) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestRayleigh) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -810,7 +811,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestRayleigh) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_impl_rev, TestScaledInvChiSquare) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestScaledInvChiSquare) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -836,7 +837,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestScaledInvChiSquare) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestStudentT) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestStudentT) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -864,7 +865,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestStudentT) { EXPECT_FLOAT_EQ(1, 1 + g[2]); } -TEST(StanMath_integrate_1d_impl_rev, TestUniform) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestUniform) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -888,7 +889,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestUniform) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestVonMises) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestVonMises) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; @@ -914,7 +915,7 @@ TEST(StanMath_integrate_1d_impl_rev, TestVonMises) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_impl_rev, TestWeibull) { +TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestWeibull) { using stan::math::exp; using stan::math::integrate_1d_impl; using stan::math::var; diff --git a/test/unit/math/rev/functor/integrate_1d_test.cpp b/test/unit/math/rev/functor/integrate_1d_test.cpp index 672e8145332..3eb6088e99e 100644 --- a/test/unit/math/rev/functor/integrate_1d_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -236,7 +237,7 @@ void test_derivatives(const F &f, double a, double b, } } -TEST(StanMath_integrate_1d_rev, test_integer_arguments) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_test_integer_arguments) { stan::math::var v; std::vector theta = {0.5}; EXPECT_NO_THROW( @@ -247,7 +248,7 @@ TEST(StanMath_integrate_1d_rev, test_integer_arguments) { v = stan::math::integrate_1d(f2{}, 0, 1.0, theta, {}, {}, msgs, 1e-6)); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_easy) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_easy) { // Easy integrals using stan::math::var; test_derivatives(f1{}, 0.2, 0.7, {0.75}, {}, {}, @@ -264,7 +265,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_easy) { {0.0}); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_zero_crossing) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_zero_crossing) { // Zero crossing integral + test x_r + vars at endpoints using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, {2.5, 3.0}, @@ -275,7 +276,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_zero_crossing) { -19.06340613646808, 21.41380852375568); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_var_right_endpoint_var_params) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_var_right_endpoint_var_params) { // Zero crossing integral + test x_r + vars at right endpoint using stan::math::var; test_derivatives( @@ -285,7 +286,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_var_right_endpoint_var_params) { {5 * pow(0.5, 1.5), 12 * 1.75 * 1.75, 4.0}, 0.0, 21.41380852375568); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_var_left_endpoint_var_params) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_var_left_endpoint_var_params) { // Zero crossing integral + test x_r + var at left endpoint using stan::math::var; test_derivatives( @@ -295,7 +296,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_var_left_endpoint_var_params) { {5 * pow(0.5, 1.5), 12 * 1.75 * 1.75, 4.0}, -19.06340613646808, 0.0); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_no_param_vars) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_no_param_vars) { // No param vars using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -305,7 +306,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_no_param_vars) { {}, -19.06340613646808, 21.41380852375568); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_left_limit_var) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_left_limit_var) { // No param vars, only left limit var using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -315,7 +316,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_left_limit_var) { {}, -19.06340613646808, 0.0); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_right_limit_var) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_right_limit_var) { // No param vars, only right limit var using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -325,7 +326,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_right_limit_var) { {}, 0.0, 21.41380852375568); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_tricky1) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_tricky1) { // Tricky integral from Boost docs + limit at infinity + no gradients using stan::math::var; test_derivatives(f4{}, 0.0, @@ -333,7 +334,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_tricky1) { {}, {}, {}, 1.772453850905516, {}); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_tricky2) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_tricky2) { // Tricky integral from Boost docs + limit at infinity with gradients using stan::math::var; test_derivatives( @@ -343,14 +344,14 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_tricky2) { -1.772453850905516 * 0.5 / (2 * pow(0.5 * 3.0, 1.5))}); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_tricky3) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_tricky3) { // Tricky integral from Boost docs using stan::math::var; test_derivatives( f6{}, 0.0, 1.0, {0.75}, {}, {}, 0.851926727945904, {0.4814066053874294}); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_zero_crossing2) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_zero_crossing2) { // Zero crossing integral + limit at infinity + var at left limit using stan::math::var; test_derivatives( @@ -359,7 +360,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_zero_crossing2) { std::numeric_limits::quiet_NaN()); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_zero_crossing3) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_zero_crossing3) { // Zero crossing integral + limit at negative infinity + var at right limit using stan::math::var; test_derivatives( @@ -368,7 +369,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_zero_crossing3) { std::numeric_limits::quiet_NaN(), 1808.042414456063); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_indefinite) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_indefinite) { // Both limits at infinity + test x_r/x_i + no gradients using stan::math::var; test_derivatives( @@ -377,7 +378,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_indefinite) { 2.536571480364399, {}); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_endpoint_precision) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_endpoint_precision) { // Various integrals of beta function using stan::math::var; test_derivatives(f11{}, 0.0, 1.0, {0.1, 0.1}, {}, {}, @@ -397,7 +398,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_endpoint_precision) { {-0.01040816326530613, -0.004852607709750566}); } -TEST(StanMath_integrate_1d_rev, TestDerivatives_gaussian) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_gaussian) { // Check Gaussian integrates to 1.0 always using stan::math::var; test_derivatives( @@ -406,7 +407,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivatives_gaussian) { {0.0, 0.0}); } -TEST(StanMath_integrate_1d_rev, TestDerivativesSameVarAtEndpointAndInParams) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivativesSameVarAtEndpointAndInParams) { using stan::math::var; var a = 2.0; @@ -422,7 +423,7 @@ TEST(StanMath_integrate_1d_rev, TestDerivativesSameVarAtEndpointAndInParams) { EXPECT_LT(std::abs(12.0 - b.adj()), 1e-8); } -TEST(StanMath_integrate_1d_rev, TestBeta) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestBeta) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -444,7 +445,7 @@ TEST(StanMath_integrate_1d_rev, TestBeta) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestCauchy) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestCauchy) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -468,7 +469,7 @@ TEST(StanMath_integrate_1d_rev, TestCauchy) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestChiSquare) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestChiSquare) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -490,7 +491,7 @@ TEST(StanMath_integrate_1d_rev, TestChiSquare) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_rev, TestDoubleExponential) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDoubleExponential) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -516,7 +517,7 @@ TEST(StanMath_integrate_1d_rev, TestDoubleExponential) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestExponential) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestExponential) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -538,7 +539,7 @@ TEST(StanMath_integrate_1d_rev, TestExponential) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_rev, TestFrechet) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestFrechet) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -562,7 +563,7 @@ TEST(StanMath_integrate_1d_rev, TestFrechet) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestGamma) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestGamma) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -586,7 +587,7 @@ TEST(StanMath_integrate_1d_rev, TestGamma) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestGumbel) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestGumbel) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -610,7 +611,7 @@ TEST(StanMath_integrate_1d_rev, TestGumbel) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestInvChiSquared) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestInvChiSquared) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -632,7 +633,7 @@ TEST(StanMath_integrate_1d_rev, TestInvChiSquared) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_rev, TestLogistic) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestLogistic) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -656,7 +657,7 @@ TEST(StanMath_integrate_1d_rev, TestLogistic) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestLogNormal) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestLogNormal) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -680,7 +681,7 @@ TEST(StanMath_integrate_1d_rev, TestLogNormal) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestNormal) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestNormal) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -704,7 +705,7 @@ TEST(StanMath_integrate_1d_rev, TestNormal) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestPareto) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestPareto) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -728,7 +729,7 @@ TEST(StanMath_integrate_1d_rev, TestPareto) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestPareto2) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestPareto2) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -754,7 +755,7 @@ TEST(StanMath_integrate_1d_rev, TestPareto2) { EXPECT_FLOAT_EQ(1, 1 + g[2]); } -TEST(StanMath_integrate_1d_rev, TestRayleigh) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestRayleigh) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -776,7 +777,7 @@ TEST(StanMath_integrate_1d_rev, TestRayleigh) { EXPECT_FLOAT_EQ(1, 1 + g[0]); } -TEST(StanMath_integrate_1d_rev, TestScaledInvChiSquare) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestScaledInvChiSquare) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -800,7 +801,7 @@ TEST(StanMath_integrate_1d_rev, TestScaledInvChiSquare) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestStudentT) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestStudentT) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -826,7 +827,7 @@ TEST(StanMath_integrate_1d_rev, TestStudentT) { EXPECT_FLOAT_EQ(1, 1 + g[2]); } -TEST(StanMath_integrate_1d_rev, TestUniform) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestUniform) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -848,7 +849,7 @@ TEST(StanMath_integrate_1d_rev, TestUniform) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestVonMises) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestVonMises) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; @@ -872,7 +873,7 @@ TEST(StanMath_integrate_1d_rev, TestVonMises) { EXPECT_FLOAT_EQ(1, 1 + g[1]); } -TEST(StanMath_integrate_1d_rev, TestWeibull) { +TEST_F(AgradRev, StanMath_integrate_1d_rev_TestWeibull) { using stan::math::exp; using stan::math::integrate_1d; using stan::math::var; diff --git a/test/unit/math/rev/functor/integrate_ode_std_vector_interface_adapter_test.cpp b/test/unit/math/rev/functor/integrate_ode_std_vector_interface_adapter_test.cpp index f8611f7f57a..8062d612379 100644 --- a/test/unit/math/rev/functor/integrate_ode_std_vector_interface_adapter_test.cpp +++ b/test/unit/math/rev/functor/integrate_ode_std_vector_interface_adapter_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(StanMathRev, vd) { +TEST_F(AgradRev, StanMathRev_vd) { using stan::math::var; harm_osc_ode_data_fun harm_osc; stan::math::internal::integrate_ode_std_vector_interface_adapter< @@ -40,7 +41,7 @@ TEST(StanMathRev, vd) { EXPECT_MATRIX_FLOAT_EQ(adjs1, adjs2); } -TEST(StanMathRev, dv) { +TEST_F(AgradRev, StanMathRev_dv) { using stan::math::var; harm_osc_ode_data_fun harm_osc; stan::math::internal::integrate_ode_std_vector_interface_adapter< @@ -76,7 +77,7 @@ TEST(StanMathRev, dv) { EXPECT_MATRIX_FLOAT_EQ(adjs1, adjs2); } -TEST(StanMathRev, vv) { +TEST_F(AgradRev, StanMathRev_vv) { using stan::math::var; harm_osc_ode_data_fun harm_osc; stan::math::internal::integrate_ode_std_vector_interface_adapter< diff --git a/test/unit/math/rev/functor/linear_dae_typed_test.cpp b/test/unit/math/rev/functor/linear_dae_typed_test.cpp index 850f3d3a8bc..b78d2a0c2e9 100644 --- a/test/unit/math/rev/functor/linear_dae_typed_test.cpp +++ b/test/unit/math/rev/functor/linear_dae_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/lorenz_ode_typed_fd_test.cpp b/test/unit/math/rev/functor/lorenz_ode_typed_fd_test.cpp index a979aeb0e42..1a9624e8682 100644 --- a/test/unit/math/rev/functor/lorenz_ode_typed_fd_test.cpp +++ b/test/unit/math/rev/functor/lorenz_ode_typed_fd_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/map_rect_concurrent_prim_test.cpp b/test/unit/math/rev/functor/map_rect_concurrent_prim_test.cpp index 8a9c82ff963..b7fe369ae98 100644 --- a/test/unit/math/rev/functor/map_rect_concurrent_prim_test.cpp +++ b/test/unit/math/rev/functor/map_rect_concurrent_prim_test.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/test/unit/math/rev/functor/map_rect_concurrent_test.cpp b/test/unit/math/rev/functor/map_rect_concurrent_test.cpp index 25afa2fc956..65b0dec034a 100644 --- a/test/unit/math/rev/functor/map_rect_concurrent_test.cpp +++ b/test/unit/math/rev/functor/map_rect_concurrent_test.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp b/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp index 7237ca43fbf..7b5ffe8532b 100644 --- a/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp +++ b/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/test/unit/math/rev/functor/map_rect_mpi_prim_test.cpp b/test/unit/math/rev/functor/map_rect_mpi_prim_test.cpp index 3eac967f46a..0296aa087c2 100644 --- a/test/unit/math/rev/functor/map_rect_mpi_prim_test.cpp +++ b/test/unit/math/rev/functor/map_rect_mpi_prim_test.cpp @@ -3,6 +3,7 @@ #ifdef STAN_MPI #include +#include #include #include diff --git a/test/unit/math/rev/functor/map_rect_mpi_test.cpp b/test/unit/math/rev/functor/map_rect_mpi_test.cpp index 9c3155552b1..40a2851ef51 100644 --- a/test/unit/math/rev/functor/map_rect_mpi_test.cpp +++ b/test/unit/math/rev/functor/map_rect_mpi_test.cpp @@ -3,6 +3,7 @@ #ifdef STAN_MPI #include +#include #include #include diff --git a/test/unit/math/rev/functor/map_rect_prim_test.cpp b/test/unit/math/rev/functor/map_rect_prim_test.cpp index 1812e344696..fbdd38ae275 100644 --- a/test/unit/math/rev/functor/map_rect_prim_test.cpp +++ b/test/unit/math/rev/functor/map_rect_prim_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/test/unit/math/rev/functor/ode_store_sensitivities_test.cpp b/test/unit/math/rev/functor/ode_store_sensitivities_test.cpp index b49028f03e9..ae8f58c330c 100644 --- a/test/unit/math/rev/functor/ode_store_sensitivities_test.cpp +++ b/test/unit/math/rev/functor/ode_store_sensitivities_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -50,7 +51,7 @@ struct aytm { } }; -TEST(AgradRev, ode_store_sensitivities) { +TEST_F(AgradRev, Rev_ode_store_sensitivities) { using stan::math::coupled_ode_system; using stan::math::var; @@ -98,7 +99,7 @@ TEST(AgradRev, ode_store_sensitivities) { stan::math::recover_memory(); } -TEST(AgradRev, ode_store_sensitivities_matrix) { +TEST_F(AgradRev, Rev_ode_store_sensitivities_matrix) { using stan::math::coupled_ode_system; using stan::math::var; diff --git a/test/unit/math/rev/functor/ode_test_functors.hpp b/test/unit/math/rev/functor/ode_test_functors.hpp index 997fc4ab075..6b966b1c3a3 100644 --- a/test/unit/math/rev/functor/ode_test_functors.hpp +++ b/test/unit/math/rev/functor/ode_test_functors.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #define STAN_DEF_ODE_SOLVER_FUNCTOR(solver_name, solver_func) \ struct solver_name##_functor { \ diff --git a/test/unit/math/rev/functor/operands_and_partials_test.cpp b/test/unit/math/rev/functor/operands_and_partials_test.cpp index 33627460be8..384573f0418 100644 --- a/test/unit/math/rev/functor/operands_and_partials_test.cpp +++ b/test/unit/math/rev/functor/operands_and_partials_test.cpp @@ -1,10 +1,11 @@ #include +#include #include #include #include #include -TEST(AgradPartialsVari, OperandsAndPartialsScal) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsScal) { using stan::math::operands_and_partials; using stan::math::var; @@ -27,7 +28,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsScal) { EXPECT_FLOAT_EQ(10.0, grad[0]); } -TEST(AgradPartialsVari, OperandsAndPartialsVec) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsVec) { using stan::math::operands_and_partials; using stan::math::var; using stan::math::vector_d; @@ -66,7 +67,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsVec) { EXPECT_FLOAT_EQ(40.0, grad[3]); } -TEST(AgradPartialsVari, OperandsAndPartialsStdVec) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsStdVec) { using stan::math::operands_and_partials; using stan::math::var; @@ -100,7 +101,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsStdVec) { EXPECT_FLOAT_EQ(40.0, grad[3]); } -TEST(AgradPartialsVari, OperandsAndPartialsMat) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsMat) { using stan::math::matrix_d; using stan::math::matrix_v; using stan::math::operands_and_partials; @@ -141,7 +142,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsMat) { EXPECT_FLOAT_EQ(120.0, grad[3]); } -TEST(AgradPartialsVari, OperandsAndPartialsMatMultivar) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsMatMultivar) { using stan::math::matrix_d; using stan::math::matrix_v; using stan::math::operands_and_partials; @@ -203,7 +204,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsMatMultivar) { EXPECT_FLOAT_EQ(80.0, grad[7]); } -TEST(AgradPartialsVari, OperandsAndPartialsMultivar) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsMultivar) { using stan::math::operands_and_partials; using stan::math::var; using stan::math::vector_d; @@ -254,7 +255,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsMultivar) { // XXX Test mixed - operands_and_partials, // vector_d, vector_v> -TEST(AgradPartialsVari, OperandsAndPartialsMultivarMixed) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsMultivarMixed) { using stan::math::matrix_v; using stan::math::operands_and_partials; using stan::math::var; @@ -328,7 +329,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsMultivarMixed) { o6.edge3_.partials_vec_[0] += d_vec2; } -TEST(AgradPartialsVari, OperandsAndPartialsVarValueMat) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsVarValueMat) { using stan::math::matrix_d; using stan::math::matrix_v; using stan::math::operands_and_partials; @@ -346,7 +347,7 @@ TEST(AgradPartialsVari, OperandsAndPartialsVarValueMat) { EXPECT_MATRIX_EQ(av.adj(), Eigen::MatrixXd::Constant(2, 2, -4)) } -TEST(AgradPartialsVari, OperandsAndPartialsStdVectorVarValueMat) { +TEST_F(AgradRev, PartialsVari_OperandsAndPartialsStdVectorVarValueMat) { using stan::math::matrix_d; using stan::math::matrix_v; using stan::math::operands_and_partials; diff --git a/test/unit/math/rev/functor/partials_propagator_test.cpp b/test/unit/math/rev/functor/partials_propagator_test.cpp index bc09e38196d..530894cc869 100644 --- a/test/unit/math/rev/functor/partials_propagator_test.cpp +++ b/test/unit/math/rev/functor/partials_propagator_test.cpp @@ -1,9 +1,10 @@ #include +#include #include #include #include -TEST(AgradPartialsVari, PartialsPropagatorScal) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorScal) { using stan::math::make_partials_propagator; using stan::math::var; @@ -26,7 +27,7 @@ TEST(AgradPartialsVari, PartialsPropagatorScal) { EXPECT_FLOAT_EQ(10.0, grad[0]); } -TEST(AgradPartialsVari, PartialsPropagatorVec) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorVec) { using stan::math::make_partials_propagator; using stan::math::var; using stan::math::vector_d; @@ -65,7 +66,7 @@ TEST(AgradPartialsVari, PartialsPropagatorVec) { EXPECT_FLOAT_EQ(40.0, grad[3]); } -TEST(AgradPartialsVari, PartialsPropagatorStdVec) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorStdVec) { using stan::math::make_partials_propagator; using stan::math::var; @@ -99,7 +100,7 @@ TEST(AgradPartialsVari, PartialsPropagatorStdVec) { EXPECT_FLOAT_EQ(40.0, grad[3]); } -TEST(AgradPartialsVari, PartialsPropagatorMat) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorMat) { using stan::math::make_partials_propagator; using stan::math::matrix_d; using stan::math::matrix_v; @@ -140,7 +141,7 @@ TEST(AgradPartialsVari, PartialsPropagatorMat) { EXPECT_FLOAT_EQ(120.0, grad[3]); } -TEST(AgradPartialsVari, PartialsPropagatorMatMultivar) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorMatMultivar) { using stan::math::make_partials_propagator; using stan::math::matrix_d; using stan::math::matrix_v; @@ -202,7 +203,7 @@ TEST(AgradPartialsVari, PartialsPropagatorMatMultivar) { EXPECT_FLOAT_EQ(80.0, grad[7]); } -TEST(AgradPartialsVari, PartialsPropagatorMultivar) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorMultivar) { using stan::math::make_partials_propagator; using stan::math::var; using stan::math::vector_d; @@ -253,7 +254,7 @@ TEST(AgradPartialsVari, PartialsPropagatorMultivar) { // XXX Test mixed - partials_propagator, // vector_d, vector_v> -TEST(AgradPartialsVari, PartialsPropagatorMultivarMixed) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorMultivarMixed) { using stan::math::make_partials_propagator; using stan::math::matrix_v; using stan::math::var; @@ -324,7 +325,7 @@ TEST(AgradPartialsVari, PartialsPropagatorMultivarMixed) { stan::math::edge<2>(o6).partials_vec_[0] += d_vec2; } -TEST(AgradPartialsVari, PartialsPropagatorVarValueMat) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorVarValueMat) { using stan::math::make_partials_propagator; using stan::math::matrix_d; using stan::math::matrix_v; @@ -342,7 +343,7 @@ TEST(AgradPartialsVari, PartialsPropagatorVarValueMat) { EXPECT_MATRIX_EQ(av.adj(), Eigen::MatrixXd::Constant(2, 2, -4)) } -TEST(AgradPartialsVari, PartialsPropagatorStdVectorVarValueMat) { +TEST_F(AgradRev, PartialsVari_PartialsPropagatorStdVectorVarValueMat) { using stan::math::make_partials_propagator; using stan::math::matrix_d; using stan::math::matrix_v; diff --git a/test/unit/math/rev/functor/pph_dae_typed_test.cpp b/test/unit/math/rev/functor/pph_dae_typed_test.cpp index 70ff3573d9c..32ef720a14f 100644 --- a/test/unit/math/rev/functor/pph_dae_typed_test.cpp +++ b/test/unit/math/rev/functor/pph_dae_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/reduce_sum_test.cpp b/test/unit/math/rev/functor/reduce_sum_test.cpp index 7f3a971b488..b68c2ef6946 100644 --- a/test/unit/math/rev/functor/reduce_sum_test.cpp +++ b/test/unit/math/rev/functor/reduce_sum_test.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -7,7 +8,7 @@ #include #include -TEST(StanMathRev_reduce_sum, no_args) { +TEST_F(AgradRev, StanMathRev_reduce_sum_no_args) { using stan::math::var; using stan::math::test::get_new_msg; using stan::math::test::sum_lpdf; @@ -22,7 +23,7 @@ TEST(StanMathRev_reduce_sum, no_args) { << "Failed for reduce_sum"; } -TEST(StanMathRev_reduce_sum, value) { +TEST_F(AgradRev, StanMathRev_reduce_sum_value) { using stan::math::test::count_lpdf; using stan::math::test::get_new_msg; double lambda_d = 10.0; @@ -51,7 +52,7 @@ TEST(StanMathRev_reduce_sum, value) { EXPECT_FLOAT_EQ(poisson_lpdf_static, poisson_lpdf_ref); } -TEST(StanMathRev_reduce_sum, gradient) { +TEST_F(AgradRev, StanMathRev_reduce_sum_gradient) { using stan::math::var; using stan::math::test::count_lpdf; using stan::math::test::get_new_msg; @@ -99,7 +100,7 @@ TEST(StanMathRev_reduce_sum, gradient) { stan::math::recover_memory(); } -TEST(StanMathRev_reduce_sum, grainsize) { +TEST_F(AgradRev, StanMathRev_reduce_sum_grainsize) { using stan::math::var; using stan::math::test::count_lpdf; using stan::math::test::get_new_msg; @@ -147,7 +148,7 @@ TEST(StanMathRev_reduce_sum, grainsize) { stan::math::recover_memory(); } -TEST(StanMathRev_reduce_sum, nesting_gradient) { +TEST_F(AgradRev, StanMathRev_reduce_sum_nesting_gradient) { using stan::math::var; using stan::math::test::get_new_msg; using stan::math::test::nesting_count_lpdf; @@ -197,7 +198,7 @@ TEST(StanMathRev_reduce_sum, nesting_gradient) { stan::math::recover_memory(); } -TEST(StanMathRev_reduce_sum, grouped_gradient) { +TEST_F(AgradRev, StanMathRev_reduce_sum_grouped_gradient) { using stan::math::var; using stan::math::test::get_new_msg; using stan::math::test::grouped_count_lpdf; @@ -257,7 +258,7 @@ TEST(StanMathRev_reduce_sum, grouped_gradient) { stan::math::recover_memory(); } -TEST(StanMathRev_reduce_sum, grouped_gradient_eigen) { +TEST_F(AgradRev, StanMathRev_reduce_sum_grouped_gradient_eigen) { using stan::math::var; using stan::math::test::get_new_msg; using stan::math::test::grouped_count_lpdf; @@ -319,7 +320,7 @@ TEST(StanMathRev_reduce_sum, grouped_gradient_eigen) { stan::math::recover_memory(); } -TEST(StanMathRev_reduce_sum, slice_group_gradient) { +TEST_F(AgradRev, StanMathRev_reduce_sum_slice_group_gradient) { using stan::math::var; using stan::math::test::get_new_msg; using stan::math::test::slice_group_count_lpdf; @@ -389,7 +390,7 @@ TEST(StanMathRev_reduce_sum, slice_group_gradient) { // reduce_sum needs still work fine whenever multiple arguments point // to the same vari internally -TEST(StanMathRev_reduce_sum, linked_args) { +TEST_F(AgradRev, StanMathRev_reduce_sum_linked_args) { using stan::math::test::arg_start_end_lpdf; using stan::math::test::get_new_msg; auto start_end_rs = [](auto&& arg1, auto&& arg2) { diff --git a/test/unit/math/rev/functor/sho_ode_adjoint_typed_error_test.cpp b/test/unit/math/rev/functor/sho_ode_adjoint_typed_error_test.cpp index d08d4fae626..c9fbe8f8f85 100644 --- a/test/unit/math/rev/functor/sho_ode_adjoint_typed_error_test.cpp +++ b/test/unit/math/rev/functor/sho_ode_adjoint_typed_error_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/sho_ode_typed_error_test.cpp b/test/unit/math/rev/functor/sho_ode_typed_error_test.cpp index 29004435625..dcd47f42e94 100644 --- a/test/unit/math/rev/functor/sho_ode_typed_error_test.cpp +++ b/test/unit/math/rev/functor/sho_ode_typed_error_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/sho_ode_typed_test.cpp b/test/unit/math/rev/functor/sho_ode_typed_test.cpp index e959bbefd77..5e8d839450b 100644 --- a/test/unit/math/rev/functor/sho_ode_typed_test.cpp +++ b/test/unit/math/rev/functor/sho_ode_typed_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/solve_newton_test.cpp b/test/unit/math/rev/functor/solve_newton_test.cpp index ae6e6474894..19d64274511 100644 --- a/test/unit/math/rev/functor/solve_newton_test.cpp +++ b/test/unit/math/rev/functor/solve_newton_test.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ TEST_F(max_steps_test, newton_dbl) { max_num_steps_test(y, is_newton); } -TEST(MathMatrixRevMat, unsolvable_flag_newton_dbl) { +TEST_F(AgradRev, MathMatrixRevMat_unsolvable_flag_newton_dbl) { Eigen::VectorXd y(2); y << 1, 1; @@ -186,7 +187,7 @@ TEST_F(max_steps_test, newton) { max_num_steps_test(y_var, is_newton); } -TEST(MathMatrixRevMat, unsolvable_flag_newton) { +TEST_F(AgradRev, MathMatrixRevMat_unsolvable_flag_newton) { Eigen::Matrix y(2); y << 1, 1; diff --git a/test/unit/math/rev/functor/solve_powell_test.cpp b/test/unit/math/rev/functor/solve_powell_test.cpp index 2c598040af8..a4d519ec49a 100644 --- a/test/unit/math/rev/functor/solve_powell_test.cpp +++ b/test/unit/math/rev/functor/solve_powell_test.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -53,7 +54,7 @@ TEST_F(error_message_test, powell_dbl) { error_conditions_test(non_linear_eq_functor(), y_3, is_newton); } -TEST(unsolvable_test, powell_dbl) { +TEST_F(AgradRev, unsolvable_test_powell_dbl) { Eigen::VectorXd y(2); y << 1, 1; unsolvable_test(y); @@ -185,7 +186,7 @@ TEST_F(error_message_test, powell) { error_conditions_test(non_linear_eq_functor(), y, is_newton); } -TEST(unsolvable_test, powell) { +TEST_F(AgradRev, unsolvable_test_powell) { using stan::math::var; Eigen::Matrix y(2); y << 1, 1; diff --git a/test/unit/math/rev/functor/test_fixture_dae_analytical.hpp b/test/unit/math/rev/functor/test_fixture_dae_analytical.hpp index 3e3ca73e7e6..4e883b13ab3 100644 --- a/test/unit/math/rev/functor/test_fixture_dae_analytical.hpp +++ b/test/unit/math/rev/functor/test_fixture_dae_analytical.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_DAE_ANALYTICAL_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_dae_chem.hpp b/test/unit/math/rev/functor/test_fixture_dae_chem.hpp index d5c420dc45c..0946cf10e6d 100644 --- a/test/unit/math/rev/functor/test_fixture_dae_chem.hpp +++ b/test/unit/math/rev/functor/test_fixture_dae_chem.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_DAE_CHEM_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_dae_index_3.hpp b/test/unit/math/rev/functor/test_fixture_dae_index_3.hpp index 09cc0065950..a81f4cb8abe 100644 --- a/test/unit/math/rev/functor/test_fixture_dae_index_3.hpp +++ b/test/unit/math/rev/functor/test_fixture_dae_index_3.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_DAE_INDEX_3_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_dae_pph.hpp b/test/unit/math/rev/functor/test_fixture_dae_pph.hpp index 0781bb5ee02..28a73401a79 100644 --- a/test/unit/math/rev/functor/test_fixture_dae_pph.hpp +++ b/test/unit/math/rev/functor/test_fixture_dae_pph.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_DAE_PREY_PREDATOR_HARVEST_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_linear_dae.hpp b/test/unit/math/rev/functor/test_fixture_linear_dae.hpp index dc0aded04ff..59f413f2185 100644 --- a/test/unit/math/rev/functor/test_fixture_linear_dae.hpp +++ b/test/unit/math/rev/functor/test_fixture_linear_dae.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_DAE_LINEAR_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_ode.hpp b/test/unit/math/rev/functor/test_fixture_ode.hpp index 1082e6ea66c..48831c4308a 100644 --- a/test/unit/math/rev/functor/test_fixture_ode.hpp +++ b/test/unit/math/rev/functor/test_fixture_ode.hpp @@ -2,6 +2,7 @@ #define TEST_UNIT_MATH_REV_FUNCTOR_ODE_FIXTURE_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_ode_cos_scalar.hpp b/test/unit/math/rev/functor/test_fixture_ode_cos_scalar.hpp index 109390a04cf..ab3a043c2ad 100644 --- a/test/unit/math/rev/functor/test_fixture_ode_cos_scalar.hpp +++ b/test/unit/math/rev/functor/test_fixture_ode_cos_scalar.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_ODE_COS_SCALAR_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_ode_fho.hpp b/test/unit/math/rev/functor/test_fixture_ode_fho.hpp index ac38801a388..3cc8214a1a5 100644 --- a/test/unit/math/rev/functor/test_fixture_ode_fho.hpp +++ b/test/unit/math/rev/functor/test_fixture_ode_fho.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_ODE_FHO_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_ode_lorenz.hpp b/test/unit/math/rev/functor/test_fixture_ode_lorenz.hpp index a1a50aa0f55..a23f6733e42 100644 --- a/test/unit/math/rev/functor/test_fixture_ode_lorenz.hpp +++ b/test/unit/math/rev/functor/test_fixture_ode_lorenz.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_ODE_LORENZ_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_ode_sho.hpp b/test/unit/math/rev/functor/test_fixture_ode_sho.hpp index 560d3d375c6..5a45bd69712 100644 --- a/test/unit/math/rev/functor/test_fixture_ode_sho.hpp +++ b/test/unit/math/rev/functor/test_fixture_ode_sho.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_ODE_SHO_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/test_fixture_ode_sho_ctl.hpp b/test/unit/math/rev/functor/test_fixture_ode_sho_ctl.hpp index 1c95d1d25dd..4b1a0abcd56 100644 --- a/test/unit/math/rev/functor/test_fixture_ode_sho_ctl.hpp +++ b/test/unit/math/rev/functor/test_fixture_ode_sho_ctl.hpp @@ -2,6 +2,7 @@ #define STAN_MATH_TEST_FIXTURE_ODE_SHO_CTL_HPP #include +#include #include #include #include diff --git a/test/unit/math/rev/functor/util_algebra_solver.hpp b/test/unit/math/rev/functor/util_algebra_solver.hpp index 34468a49cfe..4a6e14f3d8e 100644 --- a/test/unit/math/rev/functor/util_algebra_solver.hpp +++ b/test/unit/math/rev/functor/util_algebra_solver.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/test/unit/math/rev/meta/VectorBuilderHelper_test.cpp b/test/unit/math/rev/meta/VectorBuilderHelper_test.cpp index af0d0234e78..3c16968d6ff 100644 --- a/test/unit/math/rev/meta/VectorBuilderHelper_test.cpp +++ b/test/unit/math/rev/meta/VectorBuilderHelper_test.cpp @@ -1,10 +1,11 @@ #include #include +#include #include #include #include -TEST(MetaTraitsRevScal, VectorBuilderHelper_false_true) { +TEST_F(AgradRev, MetaTraitsRevScal_VectorBuilderHelper_false_true) { using stan::VectorBuilderHelper; using stan::math::size; using stan::math::var; @@ -16,7 +17,7 @@ TEST(MetaTraitsRevScal, VectorBuilderHelper_false_true) { EXPECT_THROW(dvv1.data(), std::logic_error); } -TEST(MetaTraitsRevArr, VectorBuilderHelper_false_true) { +TEST_F(AgradRev, MetaTraitsRevArr_VectorBuilderHelper_false_true) { using stan::VectorBuilderHelper; using stan::math::size; using stan::math::var; @@ -29,7 +30,7 @@ TEST(MetaTraitsRevArr, VectorBuilderHelper_false_true) { EXPECT_THROW(dvv2.data(), std::logic_error); } -TEST(MetaTraitsRevArr, VectorBuilderHelper_true_true) { +TEST_F(AgradRev, MetaTraitsRevArr_VectorBuilderHelper_true_true) { using stan::VectorBuilderHelper; using stan::math::size; using stan::math::var; @@ -56,7 +57,7 @@ TEST(MetaTraitsRevArr, VectorBuilderHelper_true_true) { EXPECT_EQ(stan::math::size(a_std_vector), data2.size()); } -TEST(MetaTraitsRevMat, VectorBuilderHelper_false_true) { +TEST_F(AgradRev, MetaTraitsRevMat_VectorBuilderHelper_false_true) { using Eigen::Dynamic; using Eigen::Matrix; using stan::VectorBuilderHelper; @@ -75,7 +76,7 @@ TEST(MetaTraitsRevMat, VectorBuilderHelper_false_true) { EXPECT_THROW(dvv3.data(), std::logic_error); } -TEST(MetaTraitsRevMat, VectorBuilderHelper_true_true) { +TEST_F(AgradRev, MetaTraitsRevMat_VectorBuilderHelper_true_true) { using Eigen::Dynamic; using Eigen::Matrix; using stan::VectorBuilderHelper; diff --git a/test/unit/math/rev/meta/VectorBuilder_test.cpp b/test/unit/math/rev/meta/VectorBuilder_test.cpp index edd3df52fdc..0037282c0af 100644 --- a/test/unit/math/rev/meta/VectorBuilder_test.cpp +++ b/test/unit/math/rev/meta/VectorBuilder_test.cpp @@ -1,10 +1,11 @@ #include #include +#include #include #include #include -TEST(MetaTraitsRevArr, VectorBuilder_false_true) { +TEST_F(AgradRev, MetaTraitsRevArr_VectorBuilder_false_true) { using stan::VectorBuilder; using stan::math::size; using stan::math::var; @@ -23,7 +24,7 @@ TEST(MetaTraitsRevArr, VectorBuilder_false_true) { EXPECT_THROW(dvv2.data(), std::logic_error); } -TEST(MetaTraitsRevArr, VectorBuilder_true_true) { +TEST_F(AgradRev, MetaTraitsRevArr_VectorBuilder_true_true) { using stan::VectorBuilder; using stan::math::size; using stan::math::var; @@ -52,7 +53,7 @@ TEST(MetaTraitsRevArr, VectorBuilder_true_true) { EXPECT_EQ(stan::math::size(a_std_vector), data2.size()); } -TEST(MetaTraitsRevMat, VectorBuilder_false_true) { +TEST_F(AgradRev, MetaTraitsRevMat_VectorBuilder_false_true) { using Eigen::Dynamic; using Eigen::Matrix; using stan::VectorBuilder; @@ -73,7 +74,7 @@ TEST(MetaTraitsRevMat, VectorBuilder_false_true) { EXPECT_THROW(dvv4.data(), std::logic_error); } -TEST(MetaTraitsRevMat, VectorBuilder_true_true) { +TEST_F(AgradRev, MetaTraitsRevMat_VectorBuilder_true_true) { using Eigen::Dynamic; using Eigen::Matrix; using stan::VectorBuilder; diff --git a/test/unit/math/rev/meta/ad_promotable_test.cpp b/test/unit/math/rev/meta/ad_promotable_test.cpp index 3f21820fe1b..9cf05e933b0 100644 --- a/test/unit/math/rev/meta/ad_promotable_test.cpp +++ b/test/unit/math/rev/meta/ad_promotable_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(MathMetaRevScal, primitive_to_var) { +TEST_F(AgradRev, MathMetaRevScal_primitive_to_var) { EXPECT_TRUE((stan::math::ad_promotable::value)); EXPECT_TRUE((stan::math::ad_promotable::value)); EXPECT_TRUE( @@ -25,7 +26,7 @@ TEST(MathMetaRevScal, primitive_to_var) { EXPECT_TRUE((stan::math::ad_promotable::value)); } -TEST(MathMetaRevScal, nonprimitive_to_var) { +TEST_F(AgradRev, MathMetaRevScal_nonprimitive_to_var) { EXPECT_FALSE( (stan::math::ad_promotable::value)); } diff --git a/test/unit/math/rev/meta/conditional_var_value_test.cpp b/test/unit/math/rev/meta/conditional_var_value_test.cpp index 73c160f4390..ee6791a600e 100644 --- a/test/unit/math/rev/meta/conditional_var_value_test.cpp +++ b/test/unit/math/rev/meta/conditional_var_value_test.cpp @@ -1,22 +1,23 @@ #include #include +#include #include -TEST(MathMetaRev, conditional_var_value_scalar) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_scalar) { using stan::conditional_var_value_t; using stan::math::var; EXPECT_SAME_TYPE(double, conditional_var_value_t); EXPECT_SAME_TYPE(var, conditional_var_value_t); } -TEST(MathMetaRev, conditional_var_value_reference) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_reference) { using stan::conditional_var_value_t; EXPECT_SAME_TYPE(double, conditional_var_value_t); EXPECT_SAME_TYPE(double, conditional_var_value_t); EXPECT_SAME_TYPE(double, conditional_var_value_t); } -TEST(MathMetaRev, conditional_var_value_vector) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_vector) { using stan::conditional_var_value_t; using stan::math::var; using stan::math::var_value; @@ -26,7 +27,7 @@ TEST(MathMetaRev, conditional_var_value_vector) { conditional_var_value_t); } -TEST(MathMetaRev, conditional_var_value_row_vector) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_row_vector) { using stan::conditional_var_value_t; using stan::math::var; using stan::math::var_value; @@ -36,7 +37,7 @@ TEST(MathMetaRev, conditional_var_value_row_vector) { conditional_var_value_t); } -TEST(MathMetaRev, conditional_var_value_matrix) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_matrix) { using stan::conditional_var_value_t; using stan::math::var; using stan::math::var_value; @@ -48,7 +49,7 @@ TEST(MathMetaRev, conditional_var_value_matrix) { conditional_var_value_t>); } -TEST(MathMetaRev, conditional_var_value_expression) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_expression) { using stan::conditional_var_value_t; using stan::math::var; using stan::math::var_value; @@ -62,7 +63,7 @@ TEST(MathMetaRev, conditional_var_value_expression) { conditional_var_value_t); } -TEST(MathMetaRev, conditional_var_value_container_T_scalar) { +TEST_F(AgradRev, MathMetaRev_conditional_var_value_container_T_scalar) { using stan::conditional_var_value_t; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/include_summand_test.cpp b/test/unit/math/rev/meta/include_summand_test.cpp index 6f519c8de99..6c2ecde818f 100644 --- a/test/unit/math/rev/meta/include_summand_test.cpp +++ b/test/unit/math/rev/meta/include_summand_test.cpp @@ -1,15 +1,16 @@ #include #include +#include #include using stan::math::include_summand; using stan::math::var; -TEST(MetaTraitsRevScal, IncludeSummandProptoTrueVar) { +TEST_F(AgradRev, MetaTraitsRevScal_IncludeSummandProptoTrueVar) { EXPECT_TRUE((include_summand::value)); } -TEST(MetaTraitsRevScal, IncludeSummandProtoTrueVarTen) { +TEST_F(AgradRev, MetaTraitsRevScal_IncludeSummandProtoTrueVarTen) { EXPECT_TRUE((include_summand::value)); } diff --git a/test/unit/math/rev/meta/is_arena_matrix_test.cpp b/test/unit/math/rev/meta/is_arena_matrix_test.cpp index dfc63f3fff6..b8d6b1bd4af 100644 --- a/test/unit/math/rev/meta/is_arena_matrix_test.cpp +++ b/test/unit/math/rev/meta/is_arena_matrix_test.cpp @@ -1,8 +1,10 @@ #include #include +#include +#include #include -TEST(MetaTraitsRevScal, is_arena_matrix_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_arena_matrix_test) { using stan::is_arena_matrix; using stan::math::arena_matrix; using stan::math::var; diff --git a/test/unit/math/rev/meta/is_constant_all_test.cpp b/test/unit/math/rev/meta/is_constant_all_test.cpp index 8c523c1bde5..e6873b5fe78 100644 --- a/test/unit/math/rev/meta/is_constant_all_test.cpp +++ b/test/unit/math/rev/meta/is_constant_all_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -9,7 +10,7 @@ void expect_not_const() { EXPECT_FALSE(temp); } -TEST(MetaTraitsRevScal, isConstantStruct) { +TEST_F(AgradRev, MetaTraitsRevScal_isConstantStruct) { expect_not_const(); expect_not_const(); expect_not_const(); @@ -18,7 +19,7 @@ TEST(MetaTraitsRevScal, isConstantStruct) { stan::math::var, stan::math::var, double, double>(); } -TEST(MetaTraitsRevArr, isConstantStruct) { +TEST_F(AgradRev, MetaTraitsRevArr_isConstantStruct) { using std::vector; expect_not_const >(); @@ -46,7 +47,7 @@ using var_v1 = Eigen::Matrix; using var_v2 = std::vector; using var_v3 = std::vector; -TEST(MetaTraitsRevMat, isConstantStruct) { +TEST_F(AgradRev, MetaTraitsRevMat_isConstantStruct) { using Eigen::Dynamic; using Eigen::Matrix; using std::vector; diff --git a/test/unit/math/rev/meta/is_fvar_test.cpp b/test/unit/math/rev/meta/is_fvar_test.cpp index 46e38837ca7..927e04d8a46 100644 --- a/test/unit/math/rev/meta/is_fvar_test.cpp +++ b/test/unit/math/rev/meta/is_fvar_test.cpp @@ -1,8 +1,10 @@ #include #include +#include +#include #include -TEST(MetaTraitsRevScal, is_fvar) { +TEST_F(AgradRev, MetaTraitsRevScal_is_fvar) { using stan::is_fvar; EXPECT_FALSE(is_fvar::value); } diff --git a/test/unit/math/rev/meta/is_rev_matrix_test.cpp b/test/unit/math/rev/meta/is_rev_matrix_test.cpp index b7457c78c29..44ebf3ae8df 100644 --- a/test/unit/math/rev/meta/is_rev_matrix_test.cpp +++ b/test/unit/math/rev/meta/is_rev_matrix_test.cpp @@ -1,8 +1,10 @@ #include #include +#include +#include #include -TEST(MetaTraitsRevScal, is_rev_matrix_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_rev_matrix_test) { using stan::is_rev_matrix; using stan::math::var; using stan::math::var_value; @@ -19,7 +21,7 @@ TEST(MetaTraitsRevScal, is_rev_matrix_test) { EXPECT_FALSE((is_rev_matrix>>::value)); } -TEST(MetaTraitsRevScal, is_rev_col_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_rev_col_vector_test) { using stan::is_rev_col_vector; using stan::math::var; using stan::math::var_value; @@ -50,7 +52,7 @@ TEST(MetaTraitsRevScal, is_rev_col_vector_test) { EXPECT_FALSE((is_rev_col_vector::value)); } -TEST(MetaTraitsRevScal, is_rev_row_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_rev_row_vector_test) { using stan::is_rev_row_vector; using stan::math::var; using stan::math::var_value; @@ -81,7 +83,7 @@ TEST(MetaTraitsRevScal, is_rev_row_vector_test) { EXPECT_FALSE((is_rev_row_vector::value)); } -TEST(MetaTraitsRevScal, is_rev_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_rev_vector_test) { using stan::is_rev_vector; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/is_var_matrix_test.cpp b/test/unit/math/rev/meta/is_var_matrix_test.cpp index cd0f11b31d4..97227016b7e 100644 --- a/test/unit/math/rev/meta/is_var_matrix_test.cpp +++ b/test/unit/math/rev/meta/is_var_matrix_test.cpp @@ -1,8 +1,10 @@ #include #include +#include +#include #include -TEST(MetaTraitsRevScal, is_var_matrix_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_var_matrix_test) { using stan::is_var_matrix; using stan::math::var; using stan::math::var_value; @@ -18,7 +20,7 @@ TEST(MetaTraitsRevScal, is_var_matrix_test) { EXPECT_FALSE((is_var_matrix::value)); } -TEST(MetaTraitsRevScal, is_var_col_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_var_col_vector_test) { using stan::is_var_col_vector; using stan::math::var; using stan::math::var_value; @@ -47,7 +49,7 @@ TEST(MetaTraitsRevScal, is_var_col_vector_test) { EXPECT_FALSE((is_var_col_vector::value)); } -TEST(MetaTraitsRevScal, is_var_row_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_var_row_vector_test) { using stan::is_var_row_vector; using stan::math::var; using stan::math::var_value; @@ -76,7 +78,7 @@ TEST(MetaTraitsRevScal, is_var_row_vector_test) { EXPECT_FALSE((is_var_row_vector::value)); } -TEST(MetaTraitsRevScal, is_var_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_var_vector_test) { using stan::is_var_vector; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/is_var_or_arithmetic_test.cpp b/test/unit/math/rev/meta/is_var_or_arithmetic_test.cpp index 4778049da7a..0372c87cfda 100644 --- a/test/unit/math/rev/meta/is_var_or_arithmetic_test.cpp +++ b/test/unit/math/rev/meta/is_var_or_arithmetic_test.cpp @@ -1,10 +1,11 @@ #include #include +#include #include #include #include -TEST(MathMetaRevScal, is_var_or_arithmetic_simple) { +TEST_F(AgradRev, MathMetaRevScal_is_var_or_arithmetic_simple) { using stan::is_var_or_arithmetic; EXPECT_TRUE(stan::is_var_or_arithmetic::value); EXPECT_TRUE(stan::is_var_or_arithmetic::value); diff --git a/test/unit/math/rev/meta/is_var_test.cpp b/test/unit/math/rev/meta/is_var_test.cpp index 6c8148d2b2e..e71ad57c250 100644 --- a/test/unit/math/rev/meta/is_var_test.cpp +++ b/test/unit/math/rev/meta/is_var_test.cpp @@ -1,8 +1,9 @@ #include #include +#include #include -TEST(MetaTraitsRevScal, is_var) { +TEST_F(AgradRev, MetaTraitsRevScal_is_var) { using stan::is_var; using stan::math::var; using stan::math::var_value; @@ -14,7 +15,7 @@ TEST(MetaTraitsRevScal, is_var) { EXPECT_FALSE((is_var>::value)); } -TEST(MetaTraitsRevScal, is_any_var_scalar) { +TEST_F(AgradRev, MetaTraitsRevScal_is_any_var_scalar) { using stan::is_any_var_scalar; using stan::is_any_var_scalar_v; using stan::math::var; diff --git a/test/unit/math/rev/meta/is_vari_test.cpp b/test/unit/math/rev/meta/is_vari_test.cpp index 818d6c3b4d7..65fa38e4916 100644 --- a/test/unit/math/rev/meta/is_vari_test.cpp +++ b/test/unit/math/rev/meta/is_vari_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(MetaTraitsRevScal, is_vari) { +TEST_F(AgradRev, MetaTraitsRevScal_is_vari) { using stan::is_vari; using stan::math::vari; using stan::math::vari_value; diff --git a/test/unit/math/rev/meta/is_vector_test.cpp b/test/unit/math/rev/meta/is_vector_test.cpp index 23a4280bc4e..58ea3101b61 100644 --- a/test/unit/math/rev/meta/is_vector_test.cpp +++ b/test/unit/math/rev/meta/is_vector_test.cpp @@ -1,8 +1,9 @@ #include #include +#include #include -TEST(MetaTraitsRevScal, is_col_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_col_vector_test) { using stan::is_col_vector; using stan::math::var; using stan::math::var_value; @@ -25,7 +26,7 @@ TEST(MetaTraitsRevScal, is_col_vector_test) { EXPECT_FALSE((is_col_vector::value)); } -TEST(MetaTraitsRevScal, is_row_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_row_vector_test) { using stan::is_row_vector; using stan::math::var; using stan::math::var_value; @@ -48,7 +49,7 @@ TEST(MetaTraitsRevScal, is_row_vector_test) { EXPECT_FALSE((is_row_vector::value)); } -TEST(MetaTraitsRevScal, is_vector_test) { +TEST_F(AgradRev, MetaTraitsRevScal_is_vector_test) { using stan::is_vector; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/partials_return_type_test.cpp b/test/unit/math/rev/meta/partials_return_type_test.cpp index cf083fbcc2b..8498459d4fe 100644 --- a/test/unit/math/rev/meta/partials_return_type_test.cpp +++ b/test/unit/math/rev/meta/partials_return_type_test.cpp @@ -1,22 +1,23 @@ #include #include +#include #include #include using stan::partials_return_type; using stan::math::var; -TEST(MetaTraitsRevScal, PartialsReturnTypeVar) { +TEST_F(AgradRev, MetaTraitsRevScal_PartialsReturnTypeVar) { EXPECT_SAME_TYPE(double, partials_return_type::type); } -TEST(MetaTraitsRevScal, PartialsReturnTypeVarTenParams) { +TEST_F(AgradRev, MetaTraitsRevScal_PartialsReturnTypeVarTenParams) { EXPECT_SAME_TYPE(double, partials_return_type::type); } -TEST(MetaTraitsRevArr, partials_return_type) { +TEST_F(AgradRev, MetaTraitsRevArr_partials_return_type) { using stan::partials_return_type; using stan::math::var; diff --git a/test/unit/math/rev/meta/partials_type_test.cpp b/test/unit/math/rev/meta/partials_type_test.cpp index d3187a0ec47..2bfefafc59c 100644 --- a/test/unit/math/rev/meta/partials_type_test.cpp +++ b/test/unit/math/rev/meta/partials_type_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(MetaTraitsRevScal, partials_type) { +TEST_F(AgradRev, MetaTraitsRevScal_partials_type) { using stan::partials_type; using stan::math::var; diff --git a/test/unit/math/rev/meta/promote_scalar_type_test.cpp b/test/unit/math/rev/meta/promote_scalar_type_test.cpp index 372a238c6a9..2d0dd8db213 100644 --- a/test/unit/math/rev/meta/promote_scalar_type_test.cpp +++ b/test/unit/math/rev/meta/promote_scalar_type_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(MathFunctionsPromoteScalar, VarMatrix) { +TEST_F(AgradRev, MathFunctionsPromoteScalar_VarMatrix) { using stan::math::var; using stan::math::var_value; expect_promote_type, var, diff --git a/test/unit/math/rev/meta/promote_var_matrix_test.cpp b/test/unit/math/rev/meta/promote_var_matrix_test.cpp index 2c94fbc3267..4e42a27f663 100644 --- a/test/unit/math/rev/meta/promote_var_matrix_test.cpp +++ b/test/unit/math/rev/meta/promote_var_matrix_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(MathFunctions, PromoteVarMatrix) { +TEST_F(AgradRev, MathFunctions_PromoteVarMatrix) { using stan::promote_var_matrix_t; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/require_generics_test.cpp b/test/unit/math/rev/meta/require_generics_test.cpp index f2f0e80d4ef..b13140a0f67 100644 --- a/test/unit/math/rev/meta/require_generics_test.cpp +++ b/test/unit/math/rev/meta/require_generics_test.cpp @@ -3,103 +3,104 @@ #include #include #include +#include #include #include #include #include -TEST(requires_rev_scal, var_test) { +TEST_F(AgradRev, requires_rev_scal_var_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::unary(); } -TEST(requires_rev_scal, var_not_test) { +TEST_F(AgradRev, requires_rev_scal_var_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::not_unary(); } -TEST(requires_rev_scal, var_all_test) { +TEST_F(AgradRev, requires_rev_scal_var_all_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::all(); } -TEST(requires_rev_scal, var_all_not_test) { +TEST_F(AgradRev, requires_rev_scal_var_all_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::all_not(); } -TEST(requires_rev_scal, var_any_test) { +TEST_F(AgradRev, requires_rev_scal_var_any_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::any(); } -TEST(requires_rev_scal, var_any_not_test) { +TEST_F(AgradRev, requires_rev_scal_var_any_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::any_not(); } -TEST(requires_rev_scal, autodiff_test) { +TEST_F(AgradRev, requires_rev_scal_autodiff_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::unary(); } -TEST(requires_rev_scal, autodiff_not_test) { +TEST_F(AgradRev, requires_rev_scal_autodiff_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::not_unary(); } -TEST(requires_rev_scal, autodiff_all_test) { +TEST_F(AgradRev, requires_rev_scal_autodiff_all_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::all(); } -TEST(requires_rev_scal, autodiff_all_not_test) { +TEST_F(AgradRev, requires_rev_scal_autodiff_all_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::all_not(); } -TEST(requires_rev_scal, autodiff_any_test) { +TEST_F(AgradRev, requires_rev_scal_autodiff_any_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::any(); } -TEST(requires_rev_scal, autodiff_any_not_test) { +TEST_F(AgradRev, requires_rev_scal_autodiff_any_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::any_not(); } -TEST(requires_rev_scal, stan_scalar_test) { +TEST_F(AgradRev, requires_rev_scal_stan_scalar_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::unary(); } -TEST(requires_rev_scal, stan_scalar_not_test) { +TEST_F(AgradRev, requires_rev_scal_stan_scalar_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::not_unary(); } -TEST(requires_rev_scal, stan_scalar_all_test) { +TEST_F(AgradRev, requires_rev_scal_stan_scalar_all_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::all(); } -TEST(requires_rev_scal, stan_scalar_all_not_test) { +TEST_F(AgradRev, requires_rev_scal_stan_scalar_all_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::all_not(); } -TEST(requires_rev_scal, stan_scalar_any_test) { +TEST_F(AgradRev, requires_rev_scal_stan_scalar_any_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker::any(); } -TEST(requires_rev_scal, stan_scalar_any_not_test) { +TEST_F(AgradRev, requires_rev_scal_stan_scalar_any_not_test) { using stan::math::var; using stan::test::require_scal_checker; require_scal_checker using require_test_not_arithmetic_return_t = stan::require_not_return_type_t; -TEST(requires_rev_scal, return_type_t_test) { +TEST_F(AgradRev, requires_rev_scal_return_type_t_test) { using stan::require_return_type_t; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/return_var_matrix_test.cpp b/test/unit/math/rev/meta/return_var_matrix_test.cpp index a532c503302..a75eb22b7bf 100644 --- a/test/unit/math/rev/meta/return_var_matrix_test.cpp +++ b/test/unit/math/rev/meta/return_var_matrix_test.cpp @@ -1,8 +1,9 @@ #include +#include #include -TEST(MathFunctions, ReturnVarMatrix) { +TEST_F(AgradRev, MathFunctions_ReturnVarMatrix) { using stan::return_var_matrix_t; using stan::math::var; using stan::math::var_value; diff --git a/test/unit/math/rev/meta/rev_matrix_type_test.cpp b/test/unit/math/rev/meta/rev_matrix_type_test.cpp index bddcd0eac26..8fb88e1f34c 100644 --- a/test/unit/math/rev/meta/rev_matrix_type_test.cpp +++ b/test/unit/math/rev/meta/rev_matrix_type_test.cpp @@ -2,9 +2,10 @@ #include #include #include +#include #include -TEST(MetaTraitsRev, rev_matrix_type_test) { +TEST_F(AgradRev, MetaTraitsRev_rev_matrix_type_test) { using v_matrix = stan::math::var_value; using v_vector = stan::math::var_value; using stan::math::matrix_d; diff --git a/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp index 288d4bae864..7dc7e284f57 100644 --- a/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp @@ -1,13 +1,13 @@ #include -#include #include +#include #include #include #include // We check that the values of the new regression match those of one built // from existing primitives. -TEST(ProbDistributionsBernoulliLogitGLM, glm_matches_bernoulli_logit_doubles) { +TEST_F(AgradRev, ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -31,8 +31,7 @@ TEST(ProbDistributionsBernoulliLogitGLM, glm_matches_bernoulli_logit_doubles) { // We check that the values of the new regression match those of one built // from existing primitives. -TEST(ProbDistributionsBernoulliLogitGLM, - glm_matches_bernoulli_logit_doubles_rand) { +TEST_F(AgradRev, ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -160,7 +159,7 @@ TYPED_TEST(ProbDistributionsBernoulliLogitGLM, broadcast_x) { EXPECT_DOUBLE_EQ(alpha1.adj(), alpha2.adj()); } -TYPED_TEST(ProbDistributionsBernoulliLogitGLM, broadcast_y) { +TYPED_TEST(ProbDistributionsBernoulliLogitGLM,broadcast_y) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/binomial_lpmf_test.cpp b/test/unit/math/rev/prob/binomial_lpmf_test.cpp index d6219f78801..bf4c5593310 100644 --- a/test/unit/math/rev/prob/binomial_lpmf_test.cpp +++ b/test/unit/math/rev/prob/binomial_lpmf_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(ProbBinomial, N_equals_0) { +TEST_F(AgradRev, ProbBinomial_N_equals_0) { using stan::math::var; for (double theta_val : {0.0, 0.5, 1.0}) { var theta = theta_val; @@ -15,7 +16,7 @@ TEST(ProbBinomial, N_equals_0) { stan::math::recover_memory(); } -TEST(ProbBinomial, N_equals_1) { +TEST_F(AgradRev, ProbBinomial_N_equals_1) { using stan::math::var; for (double theta_val : {0.0, 0.5, 1.0}) { for (int n : {0, 1}) { @@ -46,7 +47,7 @@ TEST(ProbBinomial, N_equals_1) { } } -TEST(ProbBinomial, N_equals_2) { +TEST_F(AgradRev, ProbBinomial_N_equals_2) { using stan::math::var; for (double theta_val : {0.0, 0.5, 1.0}) { for (int n : {0, 1, 2}) { @@ -84,7 +85,7 @@ TEST(ProbBinomial, N_equals_2) { } } -TEST(ProbBinomial, n_equals_N) { +TEST_F(AgradRev, ProbBinomial_n_equals_N) { using stan::math::var; var theta = 1.0; @@ -96,7 +97,7 @@ TEST(ProbBinomial, n_equals_N) { stan::math::recover_memory(); } -TEST(ProbBinomial, n_equals_N_vec) { +TEST_F(AgradRev, ProbBinomial_n_equals_N_vec) { using stan::math::var; var theta = 1.0; std::vector n = {2, 3}; @@ -110,7 +111,7 @@ TEST(ProbBinomial, n_equals_N_vec) { stan::math::recover_memory(); } -TEST(ProbBinomial, n_equals_zero) { +TEST_F(AgradRev, ProbBinomial_n_equals_zero) { using stan::math::var; var theta = 0.0; @@ -122,7 +123,7 @@ TEST(ProbBinomial, n_equals_zero) { stan::math::recover_memory(); } -TEST(ProbBinomial, n_equals_0_vec) { +TEST_F(AgradRev, ProbBinomial_n_equals_0_vec) { using stan::math::var; var theta = 0.0; std::vector n = {0, 0}; @@ -136,7 +137,7 @@ TEST(ProbBinomial, n_equals_0_vec) { stan::math::recover_memory(); } -TEST(ProbBinomial, N_equals_0_vec) { +TEST_F(AgradRev, ProbBinomial_N_equals_0_vec) { using stan::math::var; var theta = 0.0; std::vector n = {0, 0}; diff --git a/test/unit/math/rev/prob/categorical2_test.cpp b/test/unit/math/rev/prob/categorical2_test.cpp index 97b3344a84e..280f24e1c60 100644 --- a/test/unit/math/rev/prob/categorical2_test.cpp +++ b/test/unit/math/rev/prob/categorical2_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -13,7 +14,7 @@ void expect_propto_categorical_lpmf(unsigned int n1, T_prob theta1, stan::math::categorical_lpmf(n2, theta2), message); } -TEST(AgradDistributionsCategorical, Propto) { +TEST_F(AgradRev, DistributionsCategorical_Propto) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp index 4a2cf6c9930..920a2c4d982 100644 --- a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include #include @@ -651,7 +651,7 @@ TYPED_TEST(ProbDistributionsCategoricalLogitGLM, glm_interfaces) { categorical_logit_glm_lpmf(y_scal, x_var_row, alpha_var, beta_var)); } -TEST(ProbDistributionsCategoricalLogitGLM, glm_errors) { +TEST_F(AgradRev, ProbDistributionsCategoricalLogitGLM_glm_errors) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::MatrixXd; diff --git a/test/unit/math/rev/prob/dirichlet2_test.cpp b/test/unit/math/rev/prob/dirichlet2_test.cpp index 57f23995c63..2da7f2f6c44 100644 --- a/test/unit/math/rev/prob/dirichlet2_test.cpp +++ b/test/unit/math/rev/prob/dirichlet2_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/test/unit/math/rev/prob/expect_eq_diffs.hpp b/test/unit/math/rev/prob/expect_eq_diffs.hpp index 0dd9f507133..41e8ddc04b6 100644 --- a/test/unit/math/rev/prob/expect_eq_diffs.hpp +++ b/test/unit/math/rev/prob/expect_eq_diffs.hpp @@ -2,6 +2,7 @@ #define TEST_UNIT_MATH_REV_PROB_EXPECT_EQ_DIFFS_HPP #include +#include #include #include diff --git a/test/unit/math/rev/prob/inv_gamma_test.cpp b/test/unit/math/rev/prob/inv_gamma_test.cpp index bb729ec0597..ec7d3cb27ce 100644 --- a/test/unit/math/rev/prob/inv_gamma_test.cpp +++ b/test/unit/math/rev/prob/inv_gamma_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -417,7 +418,7 @@ std::vector testValues = { } // namespace inv_gamma_test_internal -TEST(ProbDistributionsInvGamma, derivativesPrecomputed) { +TEST_F(AgradRev, ProbDistributionsInvGamma_derivativesPrecomputed) { using inv_gamma_test_internal::TestValue; using inv_gamma_test_internal::testValues; using stan::math::inv_gamma_lpdf; diff --git a/test/unit/math/rev/prob/inv_wishart2_test.cpp b/test/unit/math/rev/prob/inv_wishart2_test.cpp index cc70da88423..58e1c76af1d 100644 --- a/test/unit/math/rev/prob/inv_wishart2_test.cpp +++ b/test/unit/math/rev/prob/inv_wishart2_test.cpp @@ -78,7 +78,7 @@ TEST_F(AgradDistributionsInvWishart, ProptoSigma) { "var: sigma"); } -TEST(InvWishart, check_varis_on_stack) { +TEST_F(AgradRev, InvWishart_check_varis_on_stack) { using stan::math::to_var; Eigen::MatrixXd W(2, 2); W << 2.011108, -11.20661, -11.20661, 112.94139; diff --git a/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp b/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp index 8eab1bf18b0..7fba3308f62 100644 --- a/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp +++ b/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp @@ -102,7 +102,7 @@ TEST_F(AgradDistributionsInvWishartCholesky, ProptoL_S) { stan::math::recover_memory(); } -TEST(InvWishartCholesky, check_varis_on_stack) { +TEST_F(AgradRev, InvWishartCholesky_check_varis_on_stack) { using stan::math::to_var; Eigen::MatrixXd Y(2, 2); Y << 2.011108, -11.20661, -11.20661, 112.94139; diff --git a/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp b/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp index e3871ef7c43..575cca3a806 100644 --- a/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp +++ b/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp @@ -1,6 +1,7 @@ #ifndef TEST_UNIT_MATH_REV_PROB_LKJ_CORR_CHOLESKY_TEST_FUNCTORS #define TEST_UNIT_MATH_REV_PROB_LKJ_CORR_CHOLESKY_TEST_FUNCTORS #include +#include #include namespace stan { diff --git a/test/unit/math/rev/prob/lkj_corr_test.cpp b/test/unit/math/rev/prob/lkj_corr_test.cpp index 94a61c66927..d097d2d422f 100644 --- a/test/unit/math/rev/prob/lkj_corr_test.cpp +++ b/test/unit/math/rev/prob/lkj_corr_test.cpp @@ -6,7 +6,7 @@ #include #include -TEST(ProbDistributionsLkjCorr, var) { +TEST_F(AgradRev, ProbDistributionsLkjCorr_var) { using stan::math::var; boost::random::mt19937 rng; int K = 4; @@ -27,7 +27,7 @@ TEST(ProbDistributionsLkjCorr, var) { EXPECT_FLOAT_EQ(f.val(), stan::math::lkj_corr_lpdf(Sigma, eta_d).val()); } -TEST(ProbDistributionsLkjCorrCholesky, var) { +TEST_F(AgradRev, ProbDistributionsLkjCorrCholesky_var) { using stan::math::var; boost::random::mt19937 rng; int K = 4; @@ -52,7 +52,7 @@ TEST(ProbDistributionsLkjCorrCholesky, var) { stan::math::lkj_corr_cholesky_lpdf(Sigma, eta_d).val()); } -TEST(ProbDistributionsLkjCorrCholesky, gradients) { +TEST_F(AgradRev, ProbDistributionsLkjCorrCholesky_gradients) { using stan::math::var; int dim_mat = 3; Eigen::Matrix x1(dim_mat); diff --git a/test/unit/math/rev/prob/multi_gp2_test.cpp b/test/unit/math/rev/prob/multi_gp2_test.cpp index 5e5267c1b5b..1cb2015902a 100644 --- a/test/unit/math/rev/prob/multi_gp2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp2_test.cpp @@ -63,7 +63,7 @@ TEST_F(agrad_distributions_multi_gp, ProptoSigma) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiGP, MultiGPVar) { +TEST_F(AgradRev, ProbDistributionsMultiGP_MultiGPVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -78,7 +78,7 @@ TEST(ProbDistributionsMultiGP, MultiGPVar) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiGP, MultiGPGradientUnivariate) { +TEST_F(AgradRev, ProbDistributionsMultiGP_MultiGPGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; @@ -175,7 +175,7 @@ struct multi_gp_fun { } }; -TEST(MultiGP, TestGradFunctional) { +TEST_F(AgradRev, MultiGP_TestGradFunctional) { std::vector x(3 * 2 + 3 + 3); // y x[0] = 1.0; @@ -208,7 +208,7 @@ TEST(MultiGP, TestGradFunctional) { stan::math::recover_memory(); } -TEST(MultiGP, check_varis_on_stack) { +TEST_F(AgradRev, MultiGP_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::to_var; diff --git a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp index 100e9fe9ea9..836c0c08e13 100644 --- a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp @@ -55,7 +55,7 @@ TEST_F(agrad_distributions_multi_gp_cholesky, ProptoSigma) { "var: sigma"); } -TEST(ProbDistributionsMultiGPCholesky, MultiGPCholeskyVar) { +TEST_F(AgradRev, ProbDistributionsMultiGPCholesky_MultiGPCholeskyVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -70,7 +70,7 @@ TEST(ProbDistributionsMultiGPCholesky, MultiGPCholeskyVar) { stan::math::multi_gp_cholesky_lpdf(y, L, w).val()); } -TEST(ProbDistributionsMultiGPCholesky, MultiGPCholeskyGradientUnivariate) { +TEST_F(AgradRev, ProbDistributionsMultiGPCholesky_MultiGPCholeskyGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; @@ -168,7 +168,7 @@ struct multi_gp_cholesky_fun { } }; -TEST(MultiGPCholesky, TestGradFunctional) { +TEST_F(AgradRev, MultiGPCholesky_TestGradFunctional) { std::vector x(3 * 2 + 3 + 3); // y x[0] = 1.0; @@ -199,7 +199,7 @@ TEST(MultiGPCholesky, TestGradFunctional) { test_grad(multi_gp_cholesky_fun(1, 1), u); } -TEST(ProbDistributionsMultiGPCholesky, check_varis_on_stack) { +TEST_F(AgradRev, ProbDistributionsMultiGPCholesky_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::to_var; diff --git a/test/unit/math/rev/prob/multi_normal2_test.cpp b/test/unit/math/rev/prob/multi_normal2_test.cpp index 13125455b50..28f34b49893 100644 --- a/test/unit/math/rev/prob/multi_normal2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal2_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -121,7 +122,7 @@ TEST_F(agrad_distributions_multi_normal_multi_row, ProptoSigma) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiNormal, MultiNormalVar2) { +TEST_F(AgradRev, ProbDistributionsMultiNormal_MultiNormalVar2) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -135,7 +136,7 @@ TEST(ProbDistributionsMultiNormal, MultiNormalVar2) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiNormal, MultiNormalGradientUnivariate) { +TEST_F(AgradRev, ProbDistributionsMultiNormal_MultiNormalGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; @@ -232,7 +233,7 @@ struct multi_normal_fun { } }; -TEST(ProbDistributionsMultiNormal, TestGradFunctional) { +TEST_F(AgradRev, ProbDistributionsMultiNormal_TestGradFunctional) { std::vector x(3 + 3 + 3 * 2); // y x[0] = 1.0; @@ -472,7 +473,7 @@ void test_all_multi_normal2() { } } -TEST(ProbDistributionsMultiNormal, TestGradFunctionalVectorized) { +TEST_F(AgradRev, ProbDistributionsMultiNormal_TestGradFunctionalVectorized) { test_all_multi_normal2<1, 1>(); test_all_multi_normal2<1, -1>(); test_all_multi_normal2<-1, 1>(); diff --git a/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp index 82c46bf55cc..d895aa906ee 100644 --- a/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -36,7 +37,7 @@ struct multi_normal_cholesky_fun { } }; -TEST(ProbDistributionsMultiNormalCholesky2, TestGradFunctional) { +TEST_F(AgradRev, ProbDistributionsMultiNormalCholesky2_TestGradFunctional) { std::vector x(3 + 3 + 3 * 2); // y x[0] = 1.0; @@ -282,7 +283,7 @@ void test_all_multi_normal_cholesky() { } } -TEST(ProbDistributionsMultiNormalCholesky2, TestGradFunctionalVectorized) { +TEST_F(AgradRev, ProbDistributionsMultiNormalCholesky2_TestGradFunctionalVectorized) { test_all_multi_normal_cholesky<1, 1>(); test_all_multi_normal_cholesky<1, -1>(); test_all_multi_normal_cholesky<-1, 1>(); diff --git a/test/unit/math/rev/prob/multi_normal_cholesky_test.cpp b/test/unit/math/rev/prob/multi_normal_cholesky_test.cpp index 0e5b87eadb6..ab876f47c20 100644 --- a/test/unit/math/rev/prob/multi_normal_cholesky_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_cholesky_test.cpp @@ -2,7 +2,7 @@ #include #include -TEST(ProbDistributionsMultiNormalCholesky, MultiNormalVar) { +TEST_F(AgradRev, ProbDistributionsMultiNormalCholesky_MultiNormalVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -18,7 +18,7 @@ TEST(ProbDistributionsMultiNormalCholesky, MultiNormalVar) { stan::math::multi_normal_cholesky_lpdf(y, mu, L).val()); } -TEST(ProbDistributionsMultiNormalCholesky, check_varis_on_stack) { +TEST_F(AgradRev, ProbDistributionsMultiNormalCholesky_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::to_var; diff --git a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp index 7047c189c4c..f2a2335a558 100644 --- a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -151,7 +152,7 @@ struct multi_normal_prec_fun { } }; -TEST(ProbDistributionsMultiNormalPrec2, TestGradFunctional) { +TEST_F(AgradRev, ProbDistributionsMultiNormalPrec2_TestGradFunctional) { std::vector x(3 + 3 + 3 * 2); // y x[0] = 1.0; @@ -391,7 +392,7 @@ void test_all_multi_normal_prec2() { } } -TEST(ProbDistributionsMultiNormalPrec2, TestGradFunctionalVectorized) { +TEST_F(AgradRev, ProbDistributionsMultiNormalPrec2_TestGradFunctionalVectorized) { test_all_multi_normal_prec2<1, 1>(); test_all_multi_normal_prec2<1, -1>(); test_all_multi_normal_prec2<-1, 1>(); diff --git a/test/unit/math/rev/prob/multi_normal_prec_test.cpp b/test/unit/math/rev/prob/multi_normal_prec_test.cpp index ce15cefc508..fe018691ad2 100644 --- a/test/unit/math/rev/prob/multi_normal_prec_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_prec_test.cpp @@ -1,8 +1,8 @@ #include -#include #include +#include -TEST(ProbDistributionsMultiNormalPrec, MultiNormalVar) { +TEST_F(AgradRev, ProbDistributionsMultiNormalPrec_MultiNormalVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -20,7 +20,7 @@ TEST(ProbDistributionsMultiNormalPrec, MultiNormalVar) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiNormalPrec, check_varis_on_stack) { +TEST_F(AgradRev, ProbDistributionsMultiNormalPrec_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::to_var; diff --git a/test/unit/math/rev/prob/multi_normal_test.cpp b/test/unit/math/rev/prob/multi_normal_test.cpp index 3757c6aa33a..e50fb005597 100644 --- a/test/unit/math/rev/prob/multi_normal_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_test.cpp @@ -2,7 +2,7 @@ #include #include -TEST(ProbDistributionsMultiNormal, MultiNormalVar) { +TEST_F(AgradRev, ProbDistributionsMultiNormal_MultiNormalVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -16,7 +16,7 @@ TEST(ProbDistributionsMultiNormal, MultiNormalVar) { EXPECT_FLOAT_EQ(-11.73908, stan::math::multi_normal_lpdf(y, mu, Sigma).val()); } -TEST(ProbDistributionsMultiNormal, check_varis_on_stack) { +TEST_F(AgradRev, ProbDistributionsMultiNormal_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::to_var; diff --git a/test/unit/math/rev/prob/multi_student_t2_test.cpp b/test/unit/math/rev/prob/multi_student_t2_test.cpp index 3756f653fa7..c6812c1d3cf 100644 --- a/test/unit/math/rev/prob/multi_student_t2_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t2_test.cpp @@ -75,7 +75,7 @@ TEST_F(agrad_distributions_multi_student_t, ProptoSigma) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiStudentT, MultiStudentTVar) { +TEST_F(AgradRev, ProbDistributionsMultiStudentT_MultiStudentTVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -92,7 +92,7 @@ TEST(ProbDistributionsMultiStudentT, MultiStudentTVar) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiStudentT, MultiStudentTGradientUnivariate) { +TEST_F(AgradRev, ProbDistributionsMultiStudentT_MultiStudentTGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; @@ -203,7 +203,7 @@ struct multi_student_t_fun { } }; -TEST(ProbDistributionsMultiStudentT, TestGradFunctional) { +TEST_F(AgradRev, ProbDistributionsMultiStudentT_TestGradFunctional) { std::vector x(3 + 3 + 3 * 2 + 1); // y x[0] = 1.0; @@ -532,7 +532,7 @@ void test_all_multi_student_t2() { } } -TEST(ProbDistributionsMultiStudentT, TestGradFunctionalVectorized) { +TEST_F(AgradRev, ProbDistributionsMultiStudentT_TestGradFunctionalVectorized) { test_all_multi_student_t2<1, 1>(); test_all_multi_student_t2<1, -1>(); test_all_multi_student_t2<-1, 1>(); @@ -541,7 +541,7 @@ TEST(ProbDistributionsMultiStudentT, TestGradFunctionalVectorized) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiStudentT, check_varis_on_stack) { +TEST_F(AgradRev, ProbDistributionsMultiStudentT_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using std::vector; diff --git a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp index a347fb1276c..0200a7771f1 100644 --- a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp @@ -76,7 +76,7 @@ TEST_F(agrad_distributions_multi_student_t_cholesky, ProptoL) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiStudentTCholesky, MultiStudentTVar) { +TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_MultiStudentTVar) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -96,7 +96,7 @@ TEST(ProbDistributionsMultiStudentTCholesky, MultiStudentTVar) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiStudentTCholesky, MultiStudentTGradientUnivariate) { +TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_MultiStudentTGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; @@ -209,7 +209,7 @@ struct multi_student_t_cholesky_fun { } }; -TEST(ProbDistributionsMultiStudentTCholesky, TestGradFunctional) { +TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_TestGradFunctional) { std::vector x(3 + 3 + 3 * 2 + 1); // y x[0] = 1.0; @@ -589,7 +589,7 @@ void test_all_multi_student_t_cholesky() { } } -TEST(ProbDistributionsMultiStudentTCholesky, TestGradFunctionalVectorized) { +TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_TestGradFunctionalVectorized) { test_all_multi_student_t_cholesky<1, 1>(); test_all_multi_student_t_cholesky<1, -1>(); test_all_multi_student_t_cholesky<-1, 1>(); @@ -598,7 +598,7 @@ TEST(ProbDistributionsMultiStudentTCholesky, TestGradFunctionalVectorized) { stan::math::recover_memory(); } -TEST(ProbDistributionsMultiStudentTCholesky, check_varis_on_stack) { +TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using std::vector; diff --git a/test/unit/math/rev/prob/multinomial_logit_test.cpp b/test/unit/math/rev/prob/multinomial_logit_test.cpp index de69f1115bb..df4340ec875 100644 --- a/test/unit/math/rev/prob/multinomial_logit_test.cpp +++ b/test/unit/math/rev/prob/multinomial_logit_test.cpp @@ -16,7 +16,7 @@ void expect_propto_multinomial_logit_lpmf(std::vector& ns1, T_prob beta1, message); } -TEST(AgradDistributionsMultinomialLogit, Propto) { +TEST_F(AgradRev, DistributionsMultinomialLogit_Propto) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -32,7 +32,7 @@ TEST(AgradDistributionsMultinomialLogit, Propto) { expect_propto_multinomial_logit_lpmf(ns, beta1, ns, beta2, "var: beta"); } -TEST(AgradDistributionsMultinomialLogit, check_varis_on_stack) { +TEST_F(AgradRev, DistributionsMultinomialLogit_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/multinomial_test.cpp b/test/unit/math/rev/prob/multinomial_test.cpp index 2c358f9bb24..1f369fd54e2 100644 --- a/test/unit/math/rev/prob/multinomial_test.cpp +++ b/test/unit/math/rev/prob/multinomial_test.cpp @@ -15,7 +15,7 @@ void expect_propto_multinomial(std::vector& ns1, T_prob theta1, stan::math::multinomial_lpmf(ns2, theta2), message); } -TEST(AgradDistributionsMultinomial, Propto) { +TEST_F(AgradRev, DistributionsMultinomial_Propto) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -31,7 +31,7 @@ TEST(AgradDistributionsMultinomial, Propto) { expect_propto_multinomial(ns, theta1, ns, theta2, "var: theta"); } -TEST(AgradDistributionsMultinomial, check_varis_on_stack) { +TEST_F(AgradRev, DistributionsMultinomial_check_varis_on_stack) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_2_ccdf_log_test.cpp b/test/unit/math/rev/prob/neg_binomial_2_ccdf_log_test.cpp index e9c48c8992a..c38a8eda2b3 100644 --- a/test/unit/math/rev/prob/neg_binomial_2_ccdf_log_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_2_ccdf_log_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial2, derivatives_lccdf) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivatives_lccdf) { using stan::math::neg_binomial_2_lccdf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_2_cdf_log_test.cpp b/test/unit/math/rev/prob/neg_binomial_2_cdf_log_test.cpp index 395dd4b4dbc..e72820619ab 100644 --- a/test/unit/math/rev/prob/neg_binomial_2_cdf_log_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_2_cdf_log_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial2, derivatives_lcdf_1) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivatives_lcdf_1) { using stan::math::neg_binomial_2_lcdf; using stan::math::var; @@ -31,7 +32,7 @@ TEST(ProbDistributionsNegBinomial2, derivatives_lcdf_1) { EXPECT_FLOAT_EQ(grad_diff2, gradients[1]); } -TEST(ProbDistributionsNegBinomial2, derivatives_lcdf_2) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivatives_lcdf_2) { using stan::math::neg_binomial_2_lcdf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_2_cdf_test.cpp b/test/unit/math/rev/prob/neg_binomial_2_cdf_test.cpp index 0d670b84674..c21df70c9dc 100644 --- a/test/unit/math/rev/prob/neg_binomial_2_cdf_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_2_cdf_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial2, derivatives_cdf) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivatives_cdf) { using stan::math::neg_binomial_2_cdf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_2_log_glm_lpmf_test.cpp b/test/unit/math/rev/prob/neg_binomial_2_log_glm_lpmf_test.cpp index 84263d44519..fb8cf1d02d4 100644 --- a/test/unit/math/rev/prob/neg_binomial_2_log_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_2_log_glm_lpmf_test.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include #include diff --git a/test/unit/math/rev/prob/neg_binomial_2_log_test.cpp b/test/unit/math/rev/prob/neg_binomial_2_log_test.cpp index 21da83beab2..b68939a3920 100644 --- a/test/unit/math/rev/prob/neg_binomial_2_log_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_2_log_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -473,7 +474,7 @@ std::vector testValues = { } // namespace neg_binomial_2_log_test_internal -TEST(ProbDistributionsNegBinomial2Log, derivativesPrecomputed) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2Log_derivativesPrecomputed) { using neg_binomial_2_log_test_internal::TestValue; using neg_binomial_2_log_test_internal::testValues; using stan::math::is_nan; @@ -509,7 +510,7 @@ TEST(ProbDistributionsNegBinomial2Log, derivativesPrecomputed) { } } -TEST(ProbDistributionsNegBinomial2Log, derivativesComplexStep) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2Log_derivativesComplexStep) { using boost::math::differentiation::complex_step_derivative; using stan::math::is_nan; using stan::math::log1p_exp; @@ -600,7 +601,7 @@ TEST(ProbDistributionsNegBinomial2Log, derivativesComplexStep) { } } -TEST(ProbDistributionsNegBinomial2Log, derivativesZeroOne) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2Log_derivativesZeroOne) { using stan::math::log1p_exp; using stan::math::log_diff_exp; using stan::math::log_sum_exp; @@ -673,7 +674,7 @@ TEST(ProbDistributionsNegBinomial2Log, derivativesZeroOne) { } } -TEST(ProbDistributionsNegBinomial2Log, derivatives_diff_sizes) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2Log_derivatives_diff_sizes) { using stan::math::neg_binomial_2_log_lpmf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_2_test.cpp b/test/unit/math/rev/prob/neg_binomial_2_test.cpp index 0a873fb5b1b..0b25fbbe193 100644 --- a/test/unit/math/rev/prob/neg_binomial_2_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_2_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -431,7 +432,7 @@ std::vector testValues = { }; } // namespace neg_binomial_2_test_internal -TEST(ProbDistributionsNegativeBinomial2, derivativesPrecomputed) { +TEST_F(AgradRev, ProbDistributionsNegativeBinomial2_derivativesPrecomputed) { using neg_binomial_2_test_internal::TestValue; using neg_binomial_2_test_internal::testValues; using stan::math::is_nan; @@ -467,7 +468,7 @@ TEST(ProbDistributionsNegativeBinomial2, derivativesPrecomputed) { } } -TEST(ProbDistributionsNegBinomial2, derivativesComplexStep) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivativesComplexStep) { using boost::math::differentiation::complex_step_derivative; using stan::math::is_nan; using stan::math::neg_binomial_2_lpmf; @@ -543,7 +544,7 @@ TEST(ProbDistributionsNegBinomial2, derivativesComplexStep) { } } -TEST(ProbDistributionsNegBinomial2, derivativesZeroOne) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivativesZeroOne) { using stan::math::var; using stan::test::expect_near_rel; @@ -599,7 +600,7 @@ TEST(ProbDistributionsNegBinomial2, derivativesZeroOne) { } } -TEST(ProbDistributionsNegBinomial2, derivatives_diff_sizes) { +TEST_F(AgradRev, ProbDistributionsNegBinomial2_derivatives_diff_sizes) { using stan::math::neg_binomial_2_lpmf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_ccdf_log_test.cpp b/test/unit/math/rev/prob/neg_binomial_ccdf_log_test.cpp index d062f935a7d..44695dd3dd7 100644 --- a/test/unit/math/rev/prob/neg_binomial_ccdf_log_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_ccdf_log_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial, derivatives_lccdf) { +TEST_F(AgradRev, ProbDistributionsNegBinomial_derivatives_lccdf) { using stan::math::neg_binomial_lccdf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_cdf_log_test.cpp b/test/unit/math/rev/prob/neg_binomial_cdf_log_test.cpp index 6c5ddcfef1a..287f3fc5137 100644 --- a/test/unit/math/rev/prob/neg_binomial_cdf_log_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_cdf_log_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial, derivatives_lcdf) { +TEST_F(AgradRev, ProbDistributionsNegBinomial_derivatives_lcdf) { using stan::math::neg_binomial_lcdf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_cdf_test.cpp b/test/unit/math/rev/prob/neg_binomial_cdf_test.cpp index a70c0283f33..e58fb2061a8 100644 --- a/test/unit/math/rev/prob/neg_binomial_cdf_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_cdf_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial, derivatives_cdf) { +TEST_F(AgradRev, ProbDistributionsNegBinomial_derivatives_cdf) { using stan::math::neg_binomial_cdf; using stan::math::var; diff --git a/test/unit/math/rev/prob/neg_binomial_test.cpp b/test/unit/math/rev/prob/neg_binomial_test.cpp index 7dafe1ea725..91fee6adf2d 100644 --- a/test/unit/math/rev/prob/neg_binomial_test.cpp +++ b/test/unit/math/rev/prob/neg_binomial_test.cpp @@ -1,8 +1,9 @@ #include +#include #include #include -TEST(ProbDistributionsNegBinomial, derivatives_diff_sizes) { +TEST_F(AgradRev, ProbDistributionsNegBinomial_derivatives_diff_sizes) { using stan::math::neg_binomial_lpmf; using stan::math::var; diff --git a/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp b/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp index 4cea5923e0a..7ac2fd3524e 100644 --- a/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp +++ b/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp @@ -1,13 +1,13 @@ #include -#include #include +#include #include #include #include // We check that the values of the new regression match those of one built // from existing primitives. -TEST(ProbDistributionsNormalIdGLM, glm_matches_normal_id_doubles) { +TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -30,7 +30,7 @@ TEST(ProbDistributionsNormalIdGLM, glm_matches_normal_id_doubles) { } // We check that the values of the new regression match those of one built // from existing primitives. -TEST(ProbDistributionsNormalIdGLM, glm_matches_normal_id_doubles_rand) { +TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -675,7 +675,7 @@ TYPED_TEST(ProbDistributionsNormalIdGLM, } // We check that the right errors are thrown. -TEST(ProbDistributionsNormalIdGLM, glm_matches_normal_id_error_checking) { +TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_error_checking) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -746,7 +746,7 @@ TEST(ProbDistributionsNormalIdGLM, glm_matches_normal_id_error_checking) { std::domain_error); } -TEST(ProbDistributionsNormalIdGLM, glm_type_issue_3189) { +TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_type_issue_3189) { // regression test for https://github.com/stan-dev/math/issues/3189 using Eigen::Dynamic; using Eigen::Matrix; diff --git a/test/unit/math/rev/prob/normal_log_test.cpp b/test/unit/math/rev/prob/normal_log_test.cpp index 8c4612efc6b..ff69a4d8e52 100644 --- a/test/unit/math/rev/prob/normal_log_test.cpp +++ b/test/unit/math/rev/prob/normal_log_test.cpp @@ -1,7 +1,8 @@ #include +#include #include -TEST(ProbDistributionsNormal, intVsDouble) { +TEST_F(AgradRev, ProbDistributionsNormal_intVsDouble) { using stan::math::var; for (double thetaval = -5.0; thetaval < 6.0; thetaval += 0.5) { var theta(thetaval); diff --git a/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp b/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp index 3436f57a2f8..dab8aa20650 100644 --- a/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp @@ -538,7 +538,7 @@ TYPED_TEST(ProbDistributionsOrderedLogisticGLM, glm_interfaces) { beta_var, cuts_double)); } -TEST(ProbDistributionsOrderedLogisticGLM, glm_errors) { +TEST_F(AgradRev, ProbDistributionsOrderedLogisticGLM_glm_errors) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::MatrixXd; diff --git a/test/unit/math/rev/prob/ordered_logistic_test.cpp b/test/unit/math/rev/prob/ordered_logistic_test.cpp index 2332c96a081..4d715914d07 100644 --- a/test/unit/math/rev/prob/ordered_logistic_test.cpp +++ b/test/unit/math/rev/prob/ordered_logistic_test.cpp @@ -1,10 +1,10 @@ #include -#include #include +#include #include #include -TEST(ProbDistributionsOrdLog, vv) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vv) { using stan::math::ordered_logistic_lpmf; using stan::math::var; using stan::math::vector_d; @@ -27,7 +27,7 @@ TEST(ProbDistributionsOrdLog, vv) { EXPECT_FLOAT_EQ(c_v[2].adj(), 0.0); } -TEST(ProbDistributionsOrdLog, vd) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vd) { using stan::math::ordered_logistic_lpmf; using stan::math::var; using stan::math::vector_d; @@ -59,7 +59,7 @@ TEST(ProbDistributionsOrdLog, vd) { EXPECT_FLOAT_EQ(c_v[2].adj(), 0.0); } -TEST(ProbDistributionsOrdLog, vv_vec) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vv_vec) { using stan::math::ordered_logistic_lpmf; using stan::math::var; using stan::math::vector_d; @@ -88,7 +88,7 @@ TEST(ProbDistributionsOrdLog, vv_vec) { EXPECT_FLOAT_EQ(c_v[2].adj(), 0.682830271039293); } -TEST(ProbDistributionsOrdLog, vd_vec) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vd_vec) { using stan::math::ordered_logistic_lpmf; using stan::math::var; using stan::math::vector_d; @@ -128,7 +128,7 @@ TEST(ProbDistributionsOrdLog, vd_vec) { EXPECT_FLOAT_EQ(c_v[2].adj(), 1.27666307650735); } -TEST(ProbDistributionsOrdLog, vv_stvec) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vv_stvec) { using stan::math::ordered_logistic_lpmf; using stan::math::var; using stan::math::vector_d; @@ -180,7 +180,7 @@ TEST(ProbDistributionsOrdLog, vv_stvec) { EXPECT_FLOAT_EQ(std_c_v[3][2].adj(), -0.766741064228543); } -TEST(ProbDistributionsOrdLog, vd_stvec) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vd_stvec) { using stan::math::ordered_logistic_lpmf; using stan::math::var; using stan::math::vector_d; @@ -253,7 +253,7 @@ TEST(ProbDistributionsOrdLog, vd_stvec) { EXPECT_FLOAT_EQ(std_c_v[3][2].adj(), -0.792489941440364); } -TEST(ProbDistributionsOrdLog, intErrors) { +TEST_F(AgradRev, ProbDistributionsOrdLog_intErrors) { using stan::math::ordered_logistic_lpmf; using stan::math::vector_v; @@ -297,7 +297,7 @@ TEST(ProbDistributionsOrdLog, intErrors) { EXPECT_FLOAT_EQ(std_c_v[3][2].adj(), -0.70889017256612); } -TEST(ProbDistributionsOrdLog, vv_vec_y1) { +TEST_F(AgradRev, ProbDistributionsOrdLog_vv_vec_y1) { using stan::math::inv_logit; using stan::math::ordered_logistic_lpmf; using stan::math::var; @@ -327,7 +327,7 @@ TEST(ProbDistributionsOrdLog, vv_vec_y1) { EXPECT_FLOAT_EQ(c_v[2].adj(), 0.0); } -TEST(ProbDistributionsOrdLog, single_class) { +TEST_F(AgradRev, ProbDistributionsOrdLog_single_class) { using stan::math::inv_logit; using stan::math::ordered_logistic_lpmf; using stan::math::var; diff --git a/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp b/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp index aa44a99133a..cfccd0ff494 100644 --- a/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp @@ -7,7 +7,7 @@ // We check that the values of the new regression match those of one built // from existing primitives. -TEST(ProbDistributionsPoissonLogGLM, glm_matches_poisson_log_doubles) { +TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -28,7 +28,7 @@ TEST(ProbDistributionsPoissonLogGLM, glm_matches_poisson_log_doubles) { } // We check that the values of the new regression match those of one built // from existing primitives. -TEST(ProbDistributionsPoissonLogGLM, glm_matches_poisson_log_doubles_rand) { +TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -482,7 +482,7 @@ TYPED_TEST(ProbDistributionsPoissonLogGLM, } // We check that the right errors are thrown. -TEST(ProbDistributionsPoissonLogGLM, glm_matches_poisson_log_error_checking) { +TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_error_checking) { int N = 3; int M = 2; int W = 4; @@ -539,7 +539,7 @@ TEST(ProbDistributionsPoissonLogGLM, glm_matches_poisson_log_error_checking) { std::domain_error); } -TEST(ProbDistributionsPoissonLogGLM, glm_matches_poisson_log_vars_propto) { +TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_vars_propto) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/test_gradients.hpp b/test/unit/math/rev/prob/test_gradients.hpp index 891091f83f2..d3a5aa72333 100644 --- a/test/unit/math/rev/prob/test_gradients.hpp +++ b/test/unit/math/rev/prob/test_gradients.hpp @@ -1,5 +1,6 @@ #ifndef TEST_UNIT_MATH_REV_PROB_TEST_GRADIENTS #define TEST_UNIT_MATH_REV_PROB_TEST_GRADIENTS +#include #include #include #include diff --git a/test/unit/math/rev/prob/test_gradients_multi_normal.hpp b/test/unit/math/rev/prob/test_gradients_multi_normal.hpp index c42cedadfb2..e97fe517a24 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_normal.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_normal.hpp @@ -5,6 +5,7 @@ #include #include #include +#include template std::vector finite_diffs_multi_normal( diff --git a/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp b/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp index 76fcda6a8ad..6c95e00ec50 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp @@ -5,6 +5,7 @@ #include #include #include +#include template diff --git a/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp b/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp index be0b0c74d0a..3356cd3f584 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp @@ -5,6 +5,7 @@ #include #include #include +#include template diff --git a/test/unit/math/rev/prob/weibull_test.cpp b/test/unit/math/rev/prob/weibull_test.cpp index c8cb6ff5247..27ee291946b 100644 --- a/test/unit/math/rev/prob/weibull_test.cpp +++ b/test/unit/math/rev/prob/weibull_test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -395,7 +396,7 @@ std::vector testValues = { } // namespace weibull_test_internal -TEST(ProbDistributionsWeibull, derivativesPrecomputed) { +TEST_F(AgradRev, ProbDistributionsWeibull_derivativesPrecomputed) { using stan::math::is_nan; using stan::math::value_of; using stan::math::var; diff --git a/test/unit/math/rev/prob/wiener_full_test.cpp b/test/unit/math/rev/prob/wiener_full_test.cpp index bc36395489b..4e01deaecf2 100644 --- a/test/unit/math/rev/prob/wiener_full_test.cpp +++ b/test/unit/math/rev/prob/wiener_full_test.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,7 @@ void check_scalar_types(F& f, double value, double res, double deriv) { EXPECT_NEAR(value_var.adj(), deriv, err_tol); } -TEST(ProbWienerFull, wiener_full_all_scalar) { +TEST_F(AgradRev, ProbWienerFull_wiener_full_all_scalar) { // tests all parameter types individually, with other // parameters set to double using stan::math::wiener_lpdf; @@ -110,7 +111,7 @@ TEST(ProbWienerFull, wiener_full_all_scalar) { } } -TEST(ProbWienerFullPrec, wiener_full_prec_all_scalar) { +TEST_F(AgradRev, ProbWienerFullPrec_wiener_full_prec_all_scalar) { // tests all parameter types individually, with other parameters // set to double using stan::math::wiener_lpdf; @@ -220,7 +221,7 @@ void check_vector_types(F& f, std::vector value, double res) { EXPECT_NEAR(value_of(result_var), res, err_tol); } -TEST(ProbWienerFull, wiener_full_all_vector) { +TEST_F(AgradRev, ProbWienerFull_wiener_full_all_vector) { // tests all parameter types individually, with other // parameters set to std::vector using stan::math::wiener_lpdf; diff --git a/test/unit/math/rev/prob/wishart_cholesky_test.cpp b/test/unit/math/rev/prob/wishart_cholesky_test.cpp index f2dca746cea..0e771ad081c 100644 --- a/test/unit/math/rev/prob/wishart_cholesky_test.cpp +++ b/test/unit/math/rev/prob/wishart_cholesky_test.cpp @@ -102,7 +102,7 @@ TEST_F(AgradDistributionsWishartCholesky, ProptoL_S) { stan::math::recover_memory(); } -TEST(WishartCholesky, check_varis_on_stack) { +TEST_F(AgradRev, WishartCholesky_check_varis_on_stack) { using stan::math::to_var; Eigen::MatrixXd Y(2, 2); Y << 2.011108, -11.20661, -11.20661, 112.94139; diff --git a/test/unit/math/rev/prob/wishart_test.cpp b/test/unit/math/rev/prob/wishart_test.cpp index b9622911e64..ff37ac52367 100644 --- a/test/unit/math/rev/prob/wishart_test.cpp +++ b/test/unit/math/rev/prob/wishart_test.cpp @@ -90,7 +90,7 @@ TEST_F(AgradDistributionsWishart, ProptoSigma) { stan::math::recover_memory(); } -TEST(Wishart, check_varis_on_stack) { +TEST_F(AgradRev, Wishart_check_varis_on_stack) { using stan::math::to_var; Eigen::MatrixXd W(2, 2); W << 2.011108, -11.20661, -11.20661, 112.94139; diff --git a/test/unit/math/rev/util.hpp b/test/unit/math/rev/util.hpp index 53acc1f41c4..b7a21185def 100644 --- a/test/unit/math/rev/util.hpp +++ b/test/unit/math/rev/util.hpp @@ -2,6 +2,7 @@ #define TEST_UNIT_MATH_REV_UTIL_HPP #include +#include #include #include From 40920f5427e9d96e3d5be2e8089fb36e70ed555b Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Tue, 7 Oct 2025 13:08:45 -0400 Subject: [PATCH 2/4] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- test/unit/math/rev/core/count_vars_test.cpp | 4 +++- .../math/rev/core/precomputed_gradients_test.cpp | 9 ++++++--- .../math/rev/err/check_consistent_sizes_test.cpp | 3 ++- .../fun/as_value_column_array_or_scalar_test.cpp | 6 ++++-- .../fun/as_value_column_vector_or_scalar_test.cpp | 12 ++++++++---- .../math/rev/functor/integrate_1d_impl_test.cpp | 15 ++++++++++----- test/unit/math/rev/functor/integrate_1d_test.cpp | 10 +++++++--- .../rev/prob/bernoulli_logit_glm_lpmf_test.cpp | 9 ++++++--- .../math/rev/prob/multi_gp_cholesky2_test.cpp | 3 ++- .../math/rev/prob/multi_normal_cholesky2_test.cpp | 3 ++- .../math/rev/prob/multi_normal_prec2_test.cpp | 3 ++- test/unit/math/rev/prob/multi_student_t2_test.cpp | 3 ++- .../rev/prob/multi_student_t_cholesky_test.cpp | 6 ++++-- .../math/rev/prob/normal_id_glm_lpdf_test.cpp | 6 ++++-- .../math/rev/prob/poisson_log_glm_lpmf_test.cpp | 12 ++++++++---- 15 files changed, 70 insertions(+), 34 deletions(-) diff --git a/test/unit/math/rev/core/count_vars_test.cpp b/test/unit/math/rev/core/count_vars_test.cpp index 2ca9e616ffb..25157012714 100644 --- a/test/unit/math/rev/core/count_vars_test.cpp +++ b/test/unit/math/rev/core/count_vars_test.cpp @@ -130,7 +130,9 @@ TEST_F(AgradRev, Rev_count_vars_std_vector_eigen_matrix_var_arg) { EXPECT_EQ(30, stan::math::count_vars(arg)); } -TEST_F(AgradRev, Rev_count_vars_zero_args) { EXPECT_EQ(0, stan::math::count_vars()); } +TEST_F(AgradRev, Rev_count_vars_zero_args) { + EXPECT_EQ(0, stan::math::count_vars()); +} TEST_F(AgradRev, Rev_count_vars_sum) { int arg1 = 1; diff --git a/test/unit/math/rev/core/precomputed_gradients_test.cpp b/test/unit/math/rev/core/precomputed_gradients_test.cpp index fc03a242ee4..d7d1007407a 100644 --- a/test/unit/math/rev/core/precomputed_gradients_test.cpp +++ b/test/unit/math/rev/core/precomputed_gradients_test.cpp @@ -32,7 +32,8 @@ TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients) { stan::math::recover_memory(); } -TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_vari_no_independent_vars) { +TEST_F(AgradRev, + StanAgradRevInternal_precomputed_gradients_vari_no_independent_vars) { double value = 1; std::vector vars; std::vector gradients; @@ -43,7 +44,8 @@ TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_vari_no_independent_ EXPECT_NO_THROW(vi.chain()); } -TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_vari_mismatched_sizes) { +TEST_F(AgradRev, + StanAgradRevInternal_precomputed_gradients_vari_mismatched_sizes) { double value; std::vector vars; std::vector gradients; @@ -161,7 +163,8 @@ TEST(StanAgradRevInternal, stan::math::recover_memory(); } -TEST_F(AgradRev, StanAgradRevInternal_precomputed_gradients_mismatched_containers) { +TEST_F(AgradRev, + StanAgradRevInternal_precomputed_gradients_mismatched_containers) { double value = 1; std::vector vars; std::vector gradients; diff --git a/test/unit/math/rev/err/check_consistent_sizes_test.cpp b/test/unit/math/rev/err/check_consistent_sizes_test.cpp index f420fd8568a..ec32901d2b7 100644 --- a/test/unit/math/rev/err/check_consistent_sizes_test.cpp +++ b/test/unit/math/rev/err/check_consistent_sizes_test.cpp @@ -3,7 +3,8 @@ #include #include -TEST_F(AgradRev, RevErrorHandlingScalar_CheckConsistentSizesVarCheckVectorized) { +TEST_F(AgradRev, + RevErrorHandlingScalar_CheckConsistentSizesVarCheckVectorized) { using stan::math::check_consistent_sizes; using stan::math::var; using std::vector; diff --git a/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp b/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp index 629b6c94dea..f61cf4b3bd4 100644 --- a/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_value_column_array_or_scalar_test.cpp @@ -51,7 +51,8 @@ TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_const_rowvector_lvalue) { +TEST_F(AgradRev, + MathFunRev_as_value_column_array_or_scalar_const_rowvector_lvalue) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); Eigen::Matrix a(a_val); @@ -85,7 +86,8 @@ TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_var_value_vector) { EXPECT_MATRIX_EQ(res, a_val); } -TEST_F(AgradRev, MathFunRev_as_value_column_array_or_scalar_var_value_row_vector) { +TEST_F(AgradRev, + MathFunRev_as_value_column_array_or_scalar_var_value_row_vector) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp b/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp index 10cdbf2e775..807ffc10b2c 100644 --- a/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp +++ b/test/unit/math/rev/fun/as_value_column_vector_or_scalar_test.cpp @@ -10,7 +10,8 @@ TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_scalar) { EXPECT_EQ(b_val, stan::math::as_value_column_vector_or_scalar(b)); } -TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_std_vector_lvalue) { +TEST_F(AgradRev, + MathFunRev_as_value_column_vector_or_scalar_std_vector_lvalue) { int n = 100; Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); std::vector b_val(n); @@ -24,7 +25,8 @@ TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_std_vector_lvalue) EXPECT_MATRIX_EQ(res, a_val); } -TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_std_vector_rvalue) { +TEST_F(AgradRev, + MathFunRev_as_value_column_vector_or_scalar_std_vector_rvalue) { int n = 100; Eigen::VectorXd a_val = Eigen::VectorXd::Random(n); std::vector b_val(n); @@ -48,7 +50,8 @@ TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_vector_lvalue) { EXPECT_MATRIX_EQ(res, a_val); } -TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_const_rowvector_lvalue) { +TEST_F(AgradRev, + MathFunRev_as_value_column_vector_or_scalar_const_rowvector_lvalue) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::RowVectorXd::Random(n); Eigen::Matrix a(a_val); @@ -79,7 +82,8 @@ TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_var_value_vector) { EXPECT_MATRIX_EQ(res, a_val); } -TEST_F(AgradRev, MathFunRev_as_value_column_vector_or_scalar_var_value_row_vector) { +TEST_F(AgradRev, + MathFunRev_as_value_column_vector_or_scalar_var_value_row_vector) { int n = 100; const Eigen::RowVectorXd a_val = Eigen::VectorXd::Random(n); stan::math::var_value a(a_val); diff --git a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp index fa4f230ee7d..44e05cf3850 100644 --- a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp @@ -310,7 +310,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_no_param_vars) { {}, -19.06340613646808, 21.41380852375568); } -TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_left_limit_var) { +TEST_F(AgradRev, + StanMath_integrate_1d_impl_rev_TestDerivatives_left_limit_var) { // No param vars, only left limit var using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -320,7 +321,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_left_limit_var) {}, -19.06340613646808, 0.0); } -TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_right_limit_var) { +TEST_F(AgradRev, + StanMath_integrate_1d_impl_rev_TestDerivatives_right_limit_var) { // No param vars, only right limit var using stan::math::var; test_derivatives(f3{}, -1.0, 1.0, {0.5, 1.75, 3.9}, @@ -355,7 +357,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_tricky3) { f6{}, 0.0, 1.0, {0.75}, {}, {}, 0.851926727945904, {0.4814066053874294}); } -TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing2) { +TEST_F(AgradRev, + StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing2) { // Zero crossing integral + limit at infinity + var at left limit using stan::math::var; test_derivatives( @@ -364,7 +367,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing2) std::numeric_limits::quiet_NaN()); } -TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing3) { +TEST_F(AgradRev, + StanMath_integrate_1d_impl_rev_TestDerivatives_zero_crossing3) { // Zero crossing integral + limit at negative infinity + var at right limit using stan::math::var; test_derivatives( @@ -382,7 +386,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_indefinite) { 2.536571480364399, {}); } -TEST_F(AgradRev, StanMath_integrate_1d_impl_rev_TestDerivatives_endpoint_precision) { +TEST_F(AgradRev, + StanMath_integrate_1d_impl_rev_TestDerivatives_endpoint_precision) { // Various integrals of beta function using stan::math::var; test_derivatives(f11{}, 0.0, 1.0, {0.1, 0.1}, {}, {}, diff --git a/test/unit/math/rev/functor/integrate_1d_test.cpp b/test/unit/math/rev/functor/integrate_1d_test.cpp index 766415f8d8a..5c5a0c49811 100644 --- a/test/unit/math/rev/functor/integrate_1d_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_test.cpp @@ -276,7 +276,9 @@ TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_zero_crossing) { -19.06340613646808, 21.41380852375568); } -TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_var_right_endpoint_var_params) { +TEST_F( + AgradRev, + StanMath_integrate_1d_rev_TestDerivatives_var_right_endpoint_var_params) { // Zero crossing integral + test x_r + vars at right endpoint using stan::math::var; test_derivatives( @@ -286,7 +288,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_var_right_endpoint_va {5 * pow(0.5, 1.5), 12 * 1.75 * 1.75, 4.0}, 0.0, 21.41380852375568); } -TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_var_left_endpoint_var_params) { +TEST_F(AgradRev, + StanMath_integrate_1d_rev_TestDerivatives_var_left_endpoint_var_params) { // Zero crossing integral + test x_r + var at left endpoint using stan::math::var; test_derivatives( @@ -407,7 +410,8 @@ TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivatives_gaussian) { {0.0, 0.0}); } -TEST_F(AgradRev, StanMath_integrate_1d_rev_TestDerivativesSameVarAtEndpointAndInParams) { +TEST_F(AgradRev, + StanMath_integrate_1d_rev_TestDerivativesSameVarAtEndpointAndInParams) { using stan::math::var; var a = 2.0; diff --git a/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp index 7dc7e284f57..3127f589444 100644 --- a/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp @@ -7,7 +7,8 @@ // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles) { +TEST_F(AgradRev, + ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -31,7 +32,9 @@ TEST_F(AgradRev, ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_ // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles_rand) { +TEST_F( + AgradRev, + ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -159,7 +162,7 @@ TYPED_TEST(ProbDistributionsBernoulliLogitGLM, broadcast_x) { EXPECT_DOUBLE_EQ(alpha1.adj(), alpha2.adj()); } -TYPED_TEST(ProbDistributionsBernoulliLogitGLM,broadcast_y) { +TYPED_TEST(ProbDistributionsBernoulliLogitGLM, broadcast_y) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp index 836c0c08e13..804cc35a99a 100644 --- a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp @@ -70,7 +70,8 @@ TEST_F(AgradRev, ProbDistributionsMultiGPCholesky_MultiGPCholeskyVar) { stan::math::multi_gp_cholesky_lpdf(y, L, w).val()); } -TEST_F(AgradRev, ProbDistributionsMultiGPCholesky_MultiGPCholeskyGradientUnivariate) { +TEST_F(AgradRev, + ProbDistributionsMultiGPCholesky_MultiGPCholeskyGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; diff --git a/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp index d895aa906ee..3dab097b316 100644 --- a/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp @@ -283,7 +283,8 @@ void test_all_multi_normal_cholesky() { } } -TEST_F(AgradRev, ProbDistributionsMultiNormalCholesky2_TestGradFunctionalVectorized) { +TEST_F(AgradRev, + ProbDistributionsMultiNormalCholesky2_TestGradFunctionalVectorized) { test_all_multi_normal_cholesky<1, 1>(); test_all_multi_normal_cholesky<1, -1>(); test_all_multi_normal_cholesky<-1, 1>(); diff --git a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp index f2a2335a558..3bdab3ba057 100644 --- a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp @@ -392,7 +392,8 @@ void test_all_multi_normal_prec2() { } } -TEST_F(AgradRev, ProbDistributionsMultiNormalPrec2_TestGradFunctionalVectorized) { +TEST_F(AgradRev, + ProbDistributionsMultiNormalPrec2_TestGradFunctionalVectorized) { test_all_multi_normal_prec2<1, 1>(); test_all_multi_normal_prec2<1, -1>(); test_all_multi_normal_prec2<-1, 1>(); diff --git a/test/unit/math/rev/prob/multi_student_t2_test.cpp b/test/unit/math/rev/prob/multi_student_t2_test.cpp index c6812c1d3cf..708b477d7dd 100644 --- a/test/unit/math/rev/prob/multi_student_t2_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t2_test.cpp @@ -92,7 +92,8 @@ TEST_F(AgradRev, ProbDistributionsMultiStudentT_MultiStudentTVar) { stan::math::recover_memory(); } -TEST_F(AgradRev, ProbDistributionsMultiStudentT_MultiStudentTGradientUnivariate) { +TEST_F(AgradRev, + ProbDistributionsMultiStudentT_MultiStudentTGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; diff --git a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp index 0200a7771f1..56510fc2604 100644 --- a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp @@ -96,7 +96,8 @@ TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_MultiStudentTVar) { stan::math::recover_memory(); } -TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_MultiStudentTGradientUnivariate) { +TEST_F(AgradRev, + ProbDistributionsMultiStudentTCholesky_MultiStudentTGradientUnivariate) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; @@ -589,7 +590,8 @@ void test_all_multi_student_t_cholesky() { } } -TEST_F(AgradRev, ProbDistributionsMultiStudentTCholesky_TestGradFunctionalVectorized) { +TEST_F(AgradRev, + ProbDistributionsMultiStudentTCholesky_TestGradFunctionalVectorized) { test_all_multi_student_t_cholesky<1, 1>(); test_all_multi_student_t_cholesky<1, -1>(); test_all_multi_student_t_cholesky<-1, 1>(); diff --git a/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp b/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp index 7ac2fd3524e..9d91c5fc4f9 100644 --- a/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp +++ b/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp @@ -30,7 +30,8 @@ TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles) { } // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles_rand) { +TEST_F(AgradRev, + ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -675,7 +676,8 @@ TYPED_TEST(ProbDistributionsNormalIdGLM, } // We check that the right errors are thrown. -TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_error_checking) { +TEST_F(AgradRev, + ProbDistributionsNormalIdGLM_glm_matches_normal_id_error_checking) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp b/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp index cfccd0ff494..fa299bbc344 100644 --- a/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp @@ -7,7 +7,8 @@ // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles) { +TEST_F(AgradRev, + ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -28,7 +29,8 @@ TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles) } // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles_rand) { +TEST_F(AgradRev, + ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -482,7 +484,8 @@ TYPED_TEST(ProbDistributionsPoissonLogGLM, } // We check that the right errors are thrown. -TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_error_checking) { +TEST_F(AgradRev, + ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_error_checking) { int N = 3; int M = 2; int W = 4; @@ -539,7 +542,8 @@ TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_error_ch std::domain_error); } -TEST_F(AgradRev, ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_vars_propto) { +TEST_F(AgradRev, + ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_vars_propto) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; From 1ca4162bfa3e575b64826adcaab15692e4f22233 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Tue, 7 Oct 2025 14:50:29 -0400 Subject: [PATCH 3/4] fix cpplint --- test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp | 7 ++----- .../unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp | 3 +-- test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp | 5 ++--- test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp | 6 ++---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp index 3127f589444..0137821e327 100644 --- a/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/bernoulli_logit_glm_lpmf_test.cpp @@ -7,8 +7,7 @@ // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, - ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles) { +TEST_F(AgradRev, bernoulli_glm_matches_bernoulli_logit_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -32,9 +31,7 @@ TEST_F(AgradRev, // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F( - AgradRev, - ProbDistributionsBernoulliLogitGLM_glm_matches_bernoulli_logit_doubles_rand) { +TEST_F(AgradRev, bernoulli_glm_matches_bernoulli_logit_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp index 920a2c4d982..e8ed6644769 100644 --- a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp @@ -30,8 +30,7 @@ stan::return_type_t categorical_logit_glm_simple_lpmf( return lpmf; } -TEST(ProbDistributionsCategoricalLogitGLM, - glm_matches_categorical_logit_doubles) { +TEST(ProbDistributionsCategoricalLogitGLM, glm_matches_categorical_logit_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::MatrixXd; diff --git a/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp b/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp index 9d91c5fc4f9..485334dec58 100644 --- a/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp +++ b/test/unit/math/rev/prob/normal_id_glm_lpdf_test.cpp @@ -7,7 +7,7 @@ // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles) { +TEST_F(AgradRev, normal_glm_matches_normal_id_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -30,8 +30,7 @@ TEST_F(AgradRev, ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles) { } // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, - ProbDistributionsNormalIdGLM_glm_matches_normal_id_doubles_rand) { +TEST_F(AgradRev, normal_glm_matches_normal_id_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; diff --git a/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp b/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp index fa299bbc344..1dba2fa5da4 100644 --- a/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/poisson_log_glm_lpmf_test.cpp @@ -7,8 +7,7 @@ // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, - ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles) { +TEST_F(AgradRev, poisson_glm_matches_poisson_log_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; @@ -29,8 +28,7 @@ TEST_F(AgradRev, } // We check that the values of the new regression match those of one built // from existing primitives. -TEST_F(AgradRev, - ProbDistributionsPoissonLogGLM_glm_matches_poisson_log_doubles_rand) { +TEST_F(AgradRev, poisson_glm_matches_poisson_log_doubles_rand) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::var; From 28c7048a5e040f2d202d44a5014040d94d75264f Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Tue, 7 Oct 2025 14:51:29 -0400 Subject: [PATCH 4/4] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp index e8ed6644769..920a2c4d982 100644 --- a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp @@ -30,7 +30,8 @@ stan::return_type_t categorical_logit_glm_simple_lpmf( return lpmf; } -TEST(ProbDistributionsCategoricalLogitGLM, glm_matches_categorical_logit_doubles) { +TEST(ProbDistributionsCategoricalLogitGLM, + glm_matches_categorical_logit_doubles) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::MatrixXd;