예제 #1
0
파일: Stats_test.cpp 프로젝트: rlugojr/wdt
TEST(StatsTest, CounterSimpleTest) {
  Counter c;
  c.record(-7);
  EXPECT_EQ(1, c.getCount());
  EXPECT_EQ(-7, c.getMin());
  EXPECT_EQ(-7, c.getMax());
  EXPECT_EQ(-7.0, c.getAverage());
  c.record(-9);
  EXPECT_EQ(2, c.getCount());
  EXPECT_EQ(-9, c.getMin());
  EXPECT_EQ(-7, c.getMax());
  EXPECT_EQ(-8.0, c.getAverage());
  ostringstream oss;
  c.print(oss);
  EXPECT_EQ(oss.str(), "2,-8,-9,-7,1");
}
예제 #2
0
파일: Stats_test.cpp 프로젝트: rlugojr/wdt
TEST(StatsTest, CounterNoData) {
  Counter c;
  EXPECT_EQ(0, c.getCount());
  EXPECT_TRUE(std::isnan(c.getAverage()));
  ostringstream oss;
  c.print(oss);
  std::string res = oss.str();
  EXPECT_EQ(res, "0,nan,0,0,0");
}