tee_writer_test.cpp
Go to the documentation of this file.
2 #include <gtest/gtest.h>
3 
4 namespace test {
6  public:
7  int N;
8 
9  mock_writer() : N(0) { }
10 
11  void operator()(const std::vector<std::string>& names) {
12  ++N;
13  }
14 
15  void operator()(const std::vector<double>& state) {
16  ++N;
17  }
18 
19  void operator()() {
20  ++N;
21  }
22 
24  ++N;
25  }
26  };
27 }
28 
29 class StanCallbacksTeeWriter : public ::testing::Test {
30 public:
32  : writer1(), writer2(),
33  tee_writer(writer1, writer2) { }
34 
37 };
38 
40  std::vector<std::string> names;
41 
42  tee_writer(names);
43  EXPECT_EQ(1, writer1.N);
44  EXPECT_EQ(1, writer2.N);
45 }
46 
48  std::vector<double> state;
49 
50  tee_writer(state);
51  EXPECT_EQ(1, writer1.N);
52  EXPECT_EQ(1, writer2.N);
53 }
54 
56  tee_writer("message");
57  EXPECT_EQ(1, writer1.N);
58  EXPECT_EQ(1, writer2.N);
59 }
void operator()(const std::string &message)
void operator()(const std::vector< std::string > &names)
stan::callbacks::tee_writer tee_writer
void operator()(const std::vector< double > &state)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TEST_F(StanCallbacksTeeWriter, names)
test::mock_writer writer2