OLD | NEW |
1 // Copyright (C) 2013 Google Inc. | 1 // Copyright (C) 2013 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // code. | 70 // code. |
71 // 3) Verifies that BuildComponents() returns a non-empty vector for a region | 71 // 3) Verifies that BuildComponents() returns a non-empty vector for a region |
72 // code. | 72 // code. |
73 TEST(AddressUiTest, RegionsAndComponentsAreValid) { | 73 TEST(AddressUiTest, RegionsAndComponentsAreValid) { |
74 const std::vector<std::string>& region_codes = GetRegionCodes(); | 74 const std::vector<std::string>& region_codes = GetRegionCodes(); |
75 for (size_t i = 0; i < region_codes.size(); ++i) { | 75 for (size_t i = 0; i < region_codes.size(); ++i) { |
76 SCOPED_TRACE("Region code: " + region_codes[i]); | 76 SCOPED_TRACE("Region code: " + region_codes[i]); |
77 EXPECT_EQ(2U, region_codes[i].size()); | 77 EXPECT_EQ(2U, region_codes[i].size()); |
78 EXPECT_TRUE(ComponentsAreValid( | 78 EXPECT_TRUE(ComponentsAreValid( |
79 BuildComponents(region_codes[i], std::string(), NULL))); | 79 BuildComponents(region_codes[i], std::string(), NULL))); |
80 EXPECT_FALSE(GetRequiredFields(region_codes[i]).empty()); | |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 // Verifies that BuildComponents() and GetRequiredFields() return an empty | 83 // Verifies that BuildComponents() returns an empty |
85 // vector for an invalid region code. | 84 // vector for an invalid region code. |
86 TEST(AddressUiTest, InvalidRegionCodeReturnsEmptyVector) { | 85 TEST(AddressUiTest, InvalidRegionCodeReturnsEmptyVector) { |
87 EXPECT_TRUE( | 86 EXPECT_TRUE( |
88 BuildComponents("INVALID-REGION-CODE", std::string(), NULL).empty()); | 87 BuildComponents("INVALID-REGION-CODE", std::string(), NULL).empty()); |
89 EXPECT_TRUE(GetRequiredFields("INVALID-REGION-CODE").empty()); | |
90 } | 88 } |
91 | 89 |
92 struct SeparatorData { | 90 struct SeparatorData { |
93 SeparatorData(const std::string& language_code, | 91 SeparatorData(const std::string& language_code, |
94 const std::string& compact_line_separator) | 92 const std::string& compact_line_separator) |
95 : language_code(language_code), | 93 : language_code(language_code), |
96 compact_line_separator(compact_line_separator) {} | 94 compact_line_separator(compact_line_separator) {} |
97 | 95 |
98 ~SeparatorData() {} | 96 ~SeparatorData() {} |
99 | 97 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 &components_language_code).empty()); | 167 &components_language_code).empty()); |
170 EXPECT_EQ( | 168 EXPECT_EQ( |
171 kLangugeCodes[i].components_language_code, components_language_code); | 169 kLangugeCodes[i].components_language_code, components_language_code); |
172 } | 170 } |
173 } | 171 } |
174 | 172 |
175 } // namespace | 173 } // namespace |
176 | 174 |
177 } // namespace addressinput | 175 } // namespace addressinput |
178 } // namespace i18n | 176 } // namespace i18n |
OLD | NEW |