14 #include "gmock/gmock.h"
20 class TestableValidator :
public Validator {
23 const std::vector<char32>& utf32) {
24 return MostFrequentViramaScript(utf32);
30 TEST(ValidatorTest, MostFrequentViramaScript) {
34 TestableValidator::TestableMostFrequentViramaScript({0xc05}));
37 TestableValidator::TestableMostFrequentViramaScript(
38 {
'a', 0xc05,
'b',
'c'}));
41 TestableValidator::TestableMostFrequentViramaScript(
42 {0x905, 0xc05, 0x906, 0x907}));
44 TestableValidator::TestableMostFrequentViramaScript(
45 {0xc85, 0xc05, 0xc86, 0xc87}));
47 TestableValidator::TestableMostFrequentViramaScript(
48 {0x985, 0xc05, 0x986, 0x987}));
51 TestableValidator::TestableMostFrequentViramaScript(
52 {0x964, 0xc05, 0x965, 0x965}));
57 TEST(ValidatorTest, Idempotency) {
58 std::vector<char32> str1(
59 {0xd24, 0xd23, 0xd32, 0xd4d,
'\'', 0x200d, 0x200c, 0x200d, 0x200c});
60 std::vector<char32> str2(
61 {0xd24, 0xd23, 0xd32, 0xd4d, 0x200c, 0x200d, 0x200c, 0x200d,
'\''});
62 std::vector<std::vector<char32>> result1, result2, result3, result4;
67 EXPECT_EQ(result1.size(), result2.size());
68 EXPECT_THAT(result2[0], testing::ElementsAreArray(result1[0]));
73 EXPECT_EQ(result3.size(), result4.size());
74 EXPECT_THAT(result4[0], testing::ElementsAreArray(result3[0]));