29 #include <gtest/gtest-spi.h>
30 #include <gtest/gtest.h>
43 bool check()
const override {
return true; }
45 void reset()
override { value = 0; }
46 bool zero()
const override {
return false; }
51 TEST(StatsInfoTest, NameNewStyle)
54 info.
setName(
"InfoNameNewStyle",
false);
55 ASSERT_EQ(info.
name,
"InfoNameNewStyle");
59 TEST(StatsInfoTest, NameFirstCharacter)
63 ASSERT_EQ(info.
name,
"X");
67 ASSERT_EQ(info2.
name,
"a");
71 ASSERT_EQ(info3.
name,
"_");
75 ASSERT_EQ(info4.
name,
"X.Y");
78 info5.
setName(
"a.b._.d.e",
false);
79 ASSERT_EQ(info5.
name,
"a.b._.d.e");
83 TEST(StatsInfoTest, NameOtherCharacters)
87 ASSERT_EQ(info.
name,
"abCde");
91 ASSERT_EQ(info2.
name,
"ab_de");
95 ASSERT_EQ(info3.
name,
"ab9de");
98 info4.
setName(
"a_bCD12_ef",
false);
99 ASSERT_EQ(info4.
name,
"a_bCD12_ef");
102 info5.
setName(
"a_._bC.D12_ef",
false);
103 ASSERT_EQ(info5.
name,
"a_._bC.D12_ef");
110 TEST(StatsInfoTest, NameOldStyle)
113 info.
setName(
"InfoNameOldStyle",
true);
114 ASSERT_EQ(info.
name,
"InfoNameOldStyle");
118 ASSERT_EQ(info.
id, it->second->id);
126 TEST(StatsInfoTest, DISABLED_NameOldStyleTwice)
129 std::string old_name =
"InfoNameOldStyleTwice";
131 info.
setName(
"InfoNameOldStyleTwice2",
true);
132 ASSERT_EQ(info.
name,
"InfoNameOldStyleTwice2");
143 TEST(StatsInfoTest, NameNewStyleDuplicate)
146 std::string
name =
"InfoNameNewStyleDuplicate";
160 TEST(StatsInfoTest, NameMixStyleDuplicate)
163 std::string
name =
"InfoNameMixStyleDuplicate";
201 TEST(StatsInfoTest, BaseCheckInit)
209 TEST(StatsInfoTest, BaseCheckDisplay)
212 info.
setName(
"BaseCheckDisplay");
232 TEST(StatsInfoDeathTest, NameEmpty)
235 ASSERT_ANY_THROW(info.
setName(
"",
false));
239 TEST(StatsInfoDeathTest, NameSubEmpty)
242 ASSERT_ANY_THROW(info.
setName(
".a",
false));
246 TEST(StatsInfoDeathTest, NameSubEmpty2)
249 ASSERT_ANY_THROW(info.
setName(
"A.",
false));
253 TEST(StatsInfoDeathTest, NameSubEmpty3)
256 ASSERT_ANY_THROW(info.
setName(
"a.b..c",
false));
260 TEST(StatsInfoDeathTest, NameFirstCharacterNumber)
263 ASSERT_ANY_THROW(info.
setName(
"1",
false));
267 TEST(StatsInfoDeathTest, NameFirstCharacterNumberSub)
270 ASSERT_ANY_THROW(info.
setName(
"A.1",
false));
274 TEST(StatsInfoDeathTest, NameFirstCharacterSpecial)
277 ASSERT_ANY_THROW(info.
setName(
"!",
false));
284 TEST(StatsInfoDeathTest, NameFirstCharacterSpecialSub)
287 ASSERT_ANY_THROW(info.
setName(
"A.!",
false));
291 TEST(StatsInfoDeathTest, NameOtherCharacterSpecial)
294 ASSERT_ANY_THROW(info.
setName(
"ab!de",
false));
298 TEST(StatsInfoDeathTest, NameOldStyleDuplicate)
301 std::string
name =
"InfoNameOldStyleDuplicate";
310 TEST(StatsInfoDeathTest, BaseCheckNoInit)
317 TEST(StatsInfoDeathTest, BaseCheckDisplayNoName)