@@ -151,6 +151,7 @@ struct ShortCodeTestData {
151
151
double reference_lat;
152
152
double reference_lng;
153
153
std::string short_code;
154
+ std::string test_type;
154
155
};
155
156
156
157
class ShortCodeChecks : public ::testing::TestWithParam<ShortCodeTestData> {};
@@ -167,6 +168,7 @@ std::vector<ShortCodeTestData> GetShortCodeDataFromCsv() {
167
168
test_data.reference_lat = atof (csv_records[i][1 ].c_str ());
168
169
test_data.reference_lng = atof (csv_records[i][2 ].c_str ());
169
170
test_data.short_code = csv_records[i][3 ];
171
+ test_data.test_type = csv_records[i][4 ];
170
172
data_results.push_back (test_data);
171
173
}
172
174
return data_results;
@@ -177,11 +179,15 @@ TEST_P(ShortCodeChecks, ShortCode) {
177
179
LatLng reference_loc =
178
180
LatLng{test_data.reference_lat , test_data.reference_lng };
179
181
// Shorten the code using the reference location and check.
180
- std::string actual_short = Shorten (test_data.full_code , reference_loc);
181
- EXPECT_EQ (test_data.short_code , actual_short);
182
+ if (test_data.test_type == " B" || test_data.test_type == " S" ) {
183
+ std::string actual_short = Shorten (test_data.full_code , reference_loc);
184
+ EXPECT_EQ (test_data.short_code , actual_short);
185
+ }
182
186
// Now extend the code using the reference location and check.
183
- std::string actual_full = RecoverNearest (test_data.short_code , reference_loc);
184
- EXPECT_EQ (test_data.full_code , actual_full);
187
+ if (test_data.test_type == " B" || test_data.test_type == " R" ) {
188
+ std::string actual_full = RecoverNearest (test_data.short_code , reference_loc);
189
+ EXPECT_EQ (test_data.full_code , actual_full);
190
+ }
185
191
}
186
192
187
193
INSTANTIATE_TEST_CASE_P (OLC_Tests, ShortCodeChecks,
@@ -206,4 +212,4 @@ TEST(MaxCodeLengthChecks, MaxCodeLength) {
206
212
}
207
213
208
214
} // namespace
209
- } // namespace openlocationcode
215
+ } // namespace openlocationcode
0 commit comments