From bd8941e8491343d570e50a52599aa0b28f4f6f7e Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Thu, 26 Sep 2024 17:46:00 -0400 Subject: [PATCH] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- src/stan/io/stan_csv_reader.hpp | 14 ++++++------- src/stan/mcmc/chainset.hpp | 6 +++--- src/test/unit/io/stan_csv_reader_test.cpp | 6 +++--- src/test/unit/mcmc/chainset_test.cpp | 24 +++++++++++------------ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/stan/io/stan_csv_reader.hpp b/src/stan/io/stan_csv_reader.hpp index 6718ef053f..20791e1545 100644 --- a/src/stan/io/stan_csv_reader.hpp +++ b/src/stan/io/stan_csv_reader.hpp @@ -320,10 +320,10 @@ class stan_csv_reader { if (cols == -1) { cols = current_cols; } else if (cols != current_cols) { - std::stringstream msg; - msg << "Error: expected " << cols << " columns, but found " - << current_cols << " instead for row " << rows + 1; - throw std::invalid_argument(msg.str()); + std::stringstream msg; + msg << "Error: expected " << cols << " columns, but found " + << current_cols << " instead for row " << rows + 1; + throw std::invalid_argument(msg.str()); } rows++; } @@ -397,9 +397,9 @@ class stan_csv_reader { int expected_samples = data.metadata.num_samples / data.metadata.thin; if (expected_samples != data.samples.rows()) { std::stringstream msg; - msg << "Error reading samples, expecting " << expected_samples << " samples, found " - << data.samples.rows(); - throw std::invalid_argument(msg.str()); + msg << "Error reading samples, expecting " << expected_samples + << " samples, found " << data.samples.rows(); + throw std::invalid_argument(msg.str()); } } return data; diff --git a/src/stan/mcmc/chainset.hpp b/src/stan/mcmc/chainset.hpp index ccfc03058c..86987b1675 100644 --- a/src/stan/mcmc/chainset.hpp +++ b/src/stan/mcmc/chainset.hpp @@ -32,7 +32,7 @@ using Eigen::Dynamic; * Checks that a Stan CSV file contains both a header row * and a set of draws from the posterior. * Throws exception if either are missing. - * + * * @param stan_csv parsed csv file object */ void validate_sample(const stan::io::stan_csv& stan_csv) { @@ -46,7 +46,7 @@ void validate_sample(const stan::io::stan_csv& stan_csv) { /** * Reports the expected number of post-warmup draws in the CSV output file. - * + * * @param stan_csv parsed csv file object * @return expected number of draws */ @@ -64,7 +64,7 @@ size_t thinned_samples(const stan::io::stan_csv& stan_csv) { * * @note samples are stored in column major, i.e., each column corresponds to * an output variable (element). - * + * */ class chainset { private: diff --git a/src/test/unit/io/stan_csv_reader_test.cpp b/src/test/unit/io/stan_csv_reader_test.cpp index ffe75aae32..e354c85f19 100644 --- a/src/test/unit/io/stan_csv_reader_test.cpp +++ b/src/test/unit/io/stan_csv_reader_test.cpp @@ -27,7 +27,7 @@ class StanIoStanCsvReader : public testing::Test { bernoulli_thin_stream.open( "src/test/unit/io/test_csv_files/bernoulli_thin.csv"); bernoulli_trunc_stream.open( - "src/test/unit/io/test_csv_files/bernoulli_corrupt.csv"); + "src/test/unit/io/test_csv_files/bernoulli_corrupt.csv"); bernoulli_warmup_stream.open( "src/test/unit/io/test_csv_files/bernoulli_warmup.csv"); missing_draws_stream.open( @@ -571,10 +571,10 @@ TEST_F(StanIoStanCsvReader, missing_data) { stan::io::stan_csv missing_draws; std::stringstream out; EXPECT_THROW(stan::io::stan_csv_reader::parse(missing_draws_stream, &out), - std::invalid_argument); + std::invalid_argument); stan::io::stan_csv bernoulli_trunc; EXPECT_THROW(stan::io::stan_csv_reader::parse(bernoulli_trunc_stream, &out), - std::invalid_argument); + std::invalid_argument); } TEST_F(StanIoStanCsvReader, thinned_data) { diff --git a/src/test/unit/mcmc/chainset_test.cpp b/src/test/unit/mcmc/chainset_test.cpp index 47ba2c16f5..9662c3159c 100644 --- a/src/test/unit/mcmc/chainset_test.cpp +++ b/src/test/unit/mcmc/chainset_test.cpp @@ -40,11 +40,11 @@ class McmcChains : public testing::Test { "src/test/unit/mcmc/test_csv_files/eight_schools_5iters_2.csv", std::ifstream::in); - if (!bernoulli_500_stream - || !bernoulli_default_stream || !bernoulli_thin_stream - || !bernoulli_warmup_stream || !bernoulli_zeta_stream - || !eight_schools_1_stream || !eight_schools_2_stream - || !eight_schools_5iters_1_stream || !eight_schools_5iters_2_stream) { + if (!bernoulli_500_stream || !bernoulli_default_stream + || !bernoulli_thin_stream || !bernoulli_warmup_stream + || !bernoulli_zeta_stream || !eight_schools_1_stream + || !eight_schools_2_stream || !eight_schools_5iters_1_stream + || !eight_schools_5iters_2_stream) { FAIL() << "Failed to open one or more test files"; } bernoulli_500_stream.seekg(0, std::ios::beg); @@ -91,14 +91,14 @@ class McmcChains : public testing::Test { std::stringstream out; - std::ifstream bernoulli_500_stream, - bernoulli_default_stream, bernoulli_thin_stream, bernoulli_warmup_stream, - bernoulli_zeta_stream, eight_schools_1_stream, eight_schools_2_stream, - eight_schools_5iters_1_stream, eight_schools_5iters_2_stream; + std::ifstream bernoulli_500_stream, bernoulli_default_stream, + bernoulli_thin_stream, bernoulli_warmup_stream, bernoulli_zeta_stream, + eight_schools_1_stream, eight_schools_2_stream, + eight_schools_5iters_1_stream, eight_schools_5iters_2_stream; - stan::io::stan_csv bernoulli_500, bernoulli_default, - bernoulli_thin, bernoulli_warmup, bernoulli_zeta, eight_schools_1, - eight_schools_2, eight_schools_5iters_1, eight_schools_5iters_2; + stan::io::stan_csv bernoulli_500, bernoulli_default, bernoulli_thin, + bernoulli_warmup, bernoulli_zeta, eight_schools_1, eight_schools_2, + eight_schools_5iters_1, eight_schools_5iters_2; }; TEST_F(McmcChains, constructor) {