diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-08-21 13:00:55 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:02:08 +0300 |
commit | c9b9ebc2569d079fe44cd2ef16b6909f12fb0301 (patch) | |
tree | 5d3d0c6e81bce6b22a8e71e60d5a4ea13b1e6061 /search/search_tests/query_saver_tests.cpp | |
parent | bd101de1a0a3448b490c555ec0733300b793ec3a (diff) |
Change the last queries conatiner to the list.
Diffstat (limited to 'search/search_tests/query_saver_tests.cpp')
-rw-r--r-- | search/search_tests/query_saver_tests.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/search/search_tests/query_saver_tests.cpp b/search/search_tests/query_saver_tests.cpp index 2c42cb60f4..55c5eb3bd0 100644 --- a/search/search_tests/query_saver_tests.cpp +++ b/search/search_tests/query_saver_tests.cpp @@ -16,16 +16,18 @@ namespace search UNIT_TEST(QuerySaverFogTest) { QuerySaver saver; + saver.Clear(); saver.SaveNewQuery(record1); - vector<string> const & result = saver.GetTopQueries(); + list<string> const & result = saver.GetTopQueries(); TEST_EQUAL(result.size(), 1, ()); - TEST_EQUAL(result[0], record1, ()); + TEST_EQUAL(result.front(), record1, ()); saver.Clear(); } UNIT_TEST(QuerySaverClearTest) { QuerySaver saver; + saver.Clear(); saver.SaveNewQuery(record1); TEST_GREATER(saver.GetTopQueries().size(), 0, ()); saver.Clear(); @@ -35,20 +37,21 @@ UNIT_TEST(QuerySaverClearTest) UNIT_TEST(QuerySaverOrderingTest) { QuerySaver saver; + saver.Clear(); saver.SaveNewQuery(record1); saver.SaveNewQuery(record2); { - vector<string> const & result = saver.GetTopQueries(); + list<string> const & result = saver.GetTopQueries(); TEST_EQUAL(result.size(), 2, ()); - TEST_EQUAL(result[0], record1, ()); - TEST_EQUAL(result[1], record2, ()); + TEST_EQUAL(result.back(), record1, ()); + TEST_EQUAL(result.front(), record2, ()); } saver.SaveNewQuery(record1); { - vector<string> const & result = saver.GetTopQueries(); + list<string> const & result = saver.GetTopQueries(); TEST_EQUAL(result.size(), 2, ()); - TEST_EQUAL(result[1], record1, ()); - TEST_EQUAL(result[0], record2, ()); + TEST_EQUAL(result.front(), record1, ()); + TEST_EQUAL(result.back(), record2, ()); } saver.Clear(); } @@ -56,6 +59,7 @@ UNIT_TEST(QuerySaverOrderingTest) UNIT_TEST(QuerySaverSerializerTest) { QuerySaver saver; + saver.Clear(); saver.SaveNewQuery(record1); saver.SaveNewQuery(record2); vector<char> data; @@ -65,25 +69,26 @@ UNIT_TEST(QuerySaverSerializerTest) TEST_EQUAL(saver.GetTopQueries().size(), 0, ()); saver.Deserialize(string(data.begin(), data.end())); - vector<string> const & result = saver.GetTopQueries(); + list<string> const & result = saver.GetTopQueries(); TEST_EQUAL(result.size(), 2, ()); - TEST_EQUAL(result[0], record1, ()); - TEST_EQUAL(result[1], record2, ()); + TEST_EQUAL(result.back(), record1, ()); + TEST_EQUAL(result.front(), record2, ()); } UNIT_TEST(QuerySaverPersistanceStore) { { QuerySaver saver; + saver.Clear(); saver.SaveNewQuery(record1); saver.SaveNewQuery(record2); } { QuerySaver saver; - vector<string> const & result = saver.GetTopQueries(); + list<string> const & result = saver.GetTopQueries(); TEST_EQUAL(result.size(), 2, ()); - TEST_EQUAL(result[0], record1, ()); - TEST_EQUAL(result[1], record2, ()); + TEST_EQUAL(result.back(), record1, ()); + TEST_EQUAL(result.front(), record2, ()); saver.Clear(); } } |