Merge pull request #4627 from milchakov/uber_tests_fix_master

Uber tests fix
This commit is contained in:
ygorshenin 2016-11-02 12:58:40 +03:00 committed by GitHub
commit 497982b085

View file

@ -250,17 +250,22 @@ UNIT_TEST(Uber_Smoke)
testing::RunEventLoop();
TEST_EQUAL(synchronousProducts.size(), productsContainer.size(), ());
size_t countOfEqual = 0;
for (auto const & product : synchronousProducts)
{
auto const it = find_if(
productsContainer.begin(), productsContainer.end(), [&product](uber::Product const & item)
productsContainer.begin(), productsContainer.end(),
[&product, countOfEqual](uber::Product const & item)
{
return product.m_productId == item.m_productId && product.m_name == item.m_name &&
product.m_price == item.m_price;
});
TEST(it != productsContainer.end(), ());
if (it != productsContainer.end())
++countOfEqual;
}
// At least 75 percents of products should be equal.
TEST_LESS_OR_EQUAL(static_cast<size_t>(synchronousProducts.size() * 0.75), countOfEqual, ());
}