ultimatepp/autotest/CoFindAll/CoFindAll.cpp
cxl 8c3bf72967 .autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@10460 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2016-11-17 15:20:00 +00:00

34 lines
695 B
C++

#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
TimeStop tm;
StdLogSetup(LOG_COUT|LOG_FILE);
SeedRandom();
for(int ii = 0; ii < 200; ii++) {
DUMP(ii);
int N = Random(20000000);
int mod = 6 * Random(50000) + 1;
int from = Random(N);
DUMP(N);
DUMP(mod);
DUMP(from);
Vector<int> data;
for(int i = 0; i < N; i++)
data.Add(Random());
auto f = FindAll(data, [=](int c) { return c % mod == 0; }, from);
auto cf = CoFindAll(data, [=](int c) { return c % mod == 0; }, from);
DUMP(f.GetCount());
DUMP(cf.GetCount());
ASSERT(f == cf);
LOG("================");
}
LOG("===================== OK in " << tm);
}