aboutsummaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorroubert@google.com <roubert@google.com@38ededc0-08b8-5190-f2ac-b31f878777ad>2014-03-21 12:21:37 +0000
committerroubert@google.com <roubert@google.com@38ededc0-08b8-5190-f2ac-b31f878777ad>2014-03-21 12:21:37 +0000
commite71e2ca6cddad1c126cd13ea7c5c3b9812f9f9eb (patch)
treece446652ff0f2e2554e7a921b99db168cf7c32d6 /cpp/test
parentcddbcfaacf0a7fafb942ebc66e7d9b84faf7e5f8 (diff)
downloadsrc-e71e2ca6cddad1c126cd13ea7c5c3b9812f9f9eb.tar.gz
Add the helper function RegionDataConstants::GetMaxLookupKeyDepth().
This function will be used to determine the maximum lookup key depth that it makes sense to request from the address data server for a particular region (so that not lookup keys, for which data never will exist, unnecessarily are requested from the server). git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@197 38ededc0-08b8-5190-f2ac-b31f878777ad
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/region_data_constants_test.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/cpp/test/region_data_constants_test.cc b/cpp/test/region_data_constants_test.cc
index 1be5266..5270955 100644
--- a/cpp/test/region_data_constants_test.cc
+++ b/cpp/test/region_data_constants_test.cc
@@ -80,4 +80,11 @@ INSTANTIATE_TEST_CASE_P(
AllRegionData, RegionDataTest,
testing::ValuesIn(RegionDataConstants::GetRegionCodes()));
+TEST(RegionDataConstantsTest, GetMaxLookupKeyDepth) {
+ EXPECT_EQ(0, RegionDataConstants::GetMaxLookupKeyDepth("NZ"));
+ EXPECT_EQ(1, RegionDataConstants::GetMaxLookupKeyDepth("HK"));
+ EXPECT_EQ(2, RegionDataConstants::GetMaxLookupKeyDepth("US"));
+ EXPECT_EQ(3, RegionDataConstants::GetMaxLookupKeyDepth("CN"));
+}
+
} // namespace