[new downloader] Adding a test on ForEachParentExceptForTheRoot for one parent case.

This commit is contained in:
Vladimir Byko-Ianko 2016-02-17 07:31:32 +03:00 committed by Sergey Yershov
parent c67be9cf8c
commit 489276df92

View file

@ -1295,7 +1295,9 @@ UNIT_TEST(StorageTest_ForEachParentExceptForTheRoot)
{
Storage storage(kSingleMwmCountriesTxt, make_unique<TestMapFilesDownloader>());
auto const forEach = [](TCountryId const & parentId, TCountriesVec const & descendants)
// Two parent case.
auto const forEachParentDisputableTerritory
= [](TCountryId const & parentId, TCountriesVec const & descendants)
{
if (parentId == "Country1")
{
@ -1311,7 +1313,22 @@ UNIT_TEST(StorageTest_ForEachParentExceptForTheRoot)
}
TEST(false, ());
};
storage.ForEachParentExceptForTheRoot("Disputable Territory", forEach);
storage.ForEachParentExceptForTheRoot("Disputable Territory", forEachParentDisputableTerritory);
// One parent case.
auto const forEachParentIndisputableTerritory
= [](TCountryId const & parentId, TCountriesVec const & descendants)
{
if (parentId == "Country1")
{
TCountriesVec const expectedDescendants = {"Disputable Territory", "Indisputable Territory Of Country1"};
TEST_EQUAL(descendants, expectedDescendants, ());
return;
}
TEST(false, ());
};
storage.ForEachParentExceptForTheRoot("Indisputable Territory Of Country1",
forEachParentIndisputableTerritory);
}
UNIT_TEST(StorageTest_CalcLimitRect)