diff --git a/src/test/unit/callbacks/json_writer_test.cpp b/src/test/unit/callbacks/json_writer_test.cpp index bdeb05de5b..3b0f2613e4 100644 --- a/src/test/unit/callbacks/json_writer_test.cpp +++ b/src/test/unit/callbacks/json_writer_test.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -86,9 +86,10 @@ TEST_F(StanInterfaceCallbacksJsonWriter, begin_end_record_nested) { } } )json"; - EXPECT_EQ(expected, ss.str()); - rapidjson::Document document; - ASSERT_FALSE(document.Parse<0>(ss.str().c_str()).HasParseError()); + + auto json = ss.str(); + EXPECT_EQ(expected, json); + ASSERT_TRUE(stan::test::is_valid_JSON(json)); } TEST_F(StanInterfaceCallbacksJsonWriter, write_double_vector) { @@ -147,7 +148,6 @@ TEST_F(StanInterfaceCallbacksJsonWriter, more_members) { TEST_F(StanInterfaceCallbacksJsonWriter, write_double_vector_precision2) { ss << std::setprecision(2); std::string key("key"); - const int N = 5; std::vector x{1.23456789, 2.3456789, 3.45678910, 4.567890123}; writer.write(key, x); auto out = output_sans_whitespace(ss); @@ -178,7 +178,6 @@ TEST_F(StanInterfaceCallbacksJsonWriter, write_string_special_characters) { ss.str()); } TEST_F(StanInterfaceCallbacksJsonWriter, write_double_vector_precision3) { - const int N = 5; std::vector x{1.23456789, 2.3456789, 3.45678910, 4.567890123}; ss.precision(3); writer.write("key", x); diff --git a/src/test/unit/services/pathfinder/normal_glm_test.cpp b/src/test/unit/services/pathfinder/normal_glm_test.cpp index 937e635772..f9a8393562 100644 --- a/src/test/unit/services/pathfinder/normal_glm_test.cpp +++ b/src/test/unit/services/pathfinder/normal_glm_test.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include // Locally tests can use threads but for jenkins we should just use 1 thread @@ -90,7 +90,7 @@ TEST_F(ServicesPathfinderGLM, single) { std::vector> input_iters; - int return_code = stan::services::pathfinder::pathfinder_lbfgs_single( + stan::services::pathfinder::pathfinder_lbfgs_single( model, empty_context, seed, chain, init_radius, history_size, init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param, num_iterations, num_elbo_draws, num_draws, save_iterations, refresh, callback, logger, @@ -132,8 +132,8 @@ TEST_F(ServicesPathfinderGLM, single) { for (int i = 2; i < all_mean_vals.cols(); ++i) { EXPECT_NEAR(0, all_sd_vals(2, i), .1); } - rapidjson::Document document; - ASSERT_FALSE(document.Parse<0>(diagnostic_ss.str().c_str()).HasParseError()); + auto json = diagnostic_ss.str(); + ASSERT_TRUE(stan::test::is_valid_JSON(json)); } TEST_F(ServicesPathfinderGLM, multi) { @@ -166,7 +166,7 @@ TEST_F(ServicesPathfinderGLM, multi) { std::make_unique(init_init_context())); } stan::test::mock_callback callback; - int return_code = stan::services::pathfinder::pathfinder_lbfgs_multi( + stan::services::pathfinder::pathfinder_lbfgs_multi( model, single_path_inits, seed, chain, init_radius, history_size, init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param, num_iterations, num_elbo_draws, num_draws, num_multi_draws, num_paths,