-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathmodel_output_test.cpp
More file actions
33 lines (28 loc) · 1.1 KB
/
Copy pathmodel_output_test.cpp
File metadata and controls
33 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <test/utility.hpp>
#include <stan/services/error_codes.hpp>
#include <gtest/gtest.h>
using cmdstan::test::convert_model_path;
using cmdstan::test::count_matches;
using cmdstan::test::run_command;
using cmdstan::test::run_command_output;
TEST(interface, check_model_output) {
std::vector<std::string> model_path;
model_path.push_back("src");
model_path.push_back("test");
model_path.push_back("test-models");
model_path.push_back("printer");
std::string command
= convert_model_path(model_path) + " sample num_warmup=1 num_samples=0"
+ " output file=" + convert_model_path(model_path) + ".csv";
run_command_output out = run_command(command);
EXPECT_EQ(int(stan::services::error_codes::OK), out.err_code);
EXPECT_FALSE(out.hasError);
EXPECT_TRUE(count_matches("\nz=", out.body) > 2)
<< "counted " << count_matches("\nz=", out.body)
<< " instances of \"z=\" in" << std::endl
<< out.body;
EXPECT_TRUE(count_matches("\ny=", out.body) > 2)
<< "counted " << count_matches("\ny=", out.body)
<< " instances of \"z=\" in" << std::endl
<< out.body;
}