Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
syershov authored and bykoianko committed Jun 24, 2016
1 parent ef58bd6 commit 6120f15
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions storage/storage_tests/storage_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1762,4 +1762,37 @@ UNIT_TEST(StorageTest_GetTopmostNodesFor)
TEST_EQUAL(path[1], "Palestine Region", (path));
}

UNIT_TEST(StorageTest_GetTopmostNodesForWithLevel)
{
Storage storage;

TCountriesVec path;

storage.GetTopmostNodesFor("France_Burgundy_Saone-et-Loire", path, 0);
TEST_EQUAL(path.size(), 1, (path));
TEST_EQUAL(path[0], "France", ());

storage.GetTopmostNodesFor("France_Burgundy_Saone-et-Loire", path, 1);
TEST_EQUAL(path.size(), 1, (path));
TEST_EQUAL(path[0], "France_Burgundy", ());

storage.GetTopmostNodesFor("France_Burgundy_Saone-et-Loire", path, 2);
TEST_EQUAL(path.size(), 1, (path));
TEST_EQUAL(path[0], "France_Burgundy_Saone-et-Loire", ());

// Below tests must return path with single element same as input.
storage.GetTopmostNodesFor("France_Burgundy_Saone-et-Loire", path, 3);
TEST_EQUAL(path.size(), 1, (path));
TEST_EQUAL(path[0], "France_Burgundy_Saone-et-Loire", ());

storage.GetTopmostNodesFor("France_Burgundy_Saone-et-Loire", path, -1);
TEST_EQUAL(path.size(), 1, (path));
TEST_EQUAL(path[0], "France_Burgundy_Saone-et-Loire", ());

storage.GetTopmostNodesFor("France_Burgundy_Saone-et-Loire", path, 10000);
TEST_EQUAL(path.size(), 1, (path));
TEST_EQUAL(path[0], "France_Burgundy_Saone-et-Loire", ());
}


} // namespace storage

0 comments on commit 6120f15

Please sign in to comment.