Skip to content

Commit

Permalink
a bit of integration tests restructuring.
Browse files Browse the repository at this point in the history
  • Loading branch information
searchivairus committed Feb 2, 2018
1 parent 15a2b7d commit 31de09d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions similarity_search/test/test_integr_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ size_t RunTestExper(const vector<MethodTestCase>& vTestCases,

size_t nFail = 0;

if (!KnnArg.empty() && !RangeArg.empty()) {
PREPARE_RUNTIME_ERR(err) << "Function: " << __func__ << " cannot test range and k-NN search jointly!";
THROW_RUNTIME_ERR(err);
}

if (!KnnArg.empty()) {
if (!SplitStr(KnnArg, knn, ',')) {
Expand Down Expand Up @@ -346,6 +350,10 @@ size_t RunTestExper(const vector<MethodTestCase>& vTestCases,
cout << "Testing: " << yellow << methodName << no_color << endl;
LOG(LIB_INFO) << ">>>> Index type : " << methodName;

// Exactly one range or k-NN search is executed
CHECK_MSG(config.GetRange().size() + config.GetKNN().size() == 1,
"Exactly one k-NN or range search should be executed!");

vector<vector<MetaAnalysis*>> expResRange(config.GetRange().size(),
vector<MetaAnalysis*>(1));
vector<vector<MetaAnalysis*>> expResKNN(config.GetKNN().size(),
Expand All @@ -354,8 +362,6 @@ size_t RunTestExper(const vector<MethodTestCase>& vTestCases,
vector<string> vCmdStrRange(expResRange.size());
vector<string> vCmdStrKNN(expResKNN.size());

cout << yellow << "Command lines:" << no_color << endl;

for (size_t i = 0; i < config.GetRange().size(); ++i) {
expResRange[i][0] = new MetaAnalysis(config.GetTestSetToRunQty());

Expand Down Expand Up @@ -491,15 +497,12 @@ size_t RunTestExper(const vector<MethodTestCase>& vTestCases,

}

cout << yellow << "One test complete." << no_color << endl;

string Print, Data, Header;

for (size_t i = 0; i < config.GetRange().size(); ++i) {
MetaAnalysis* res = expResRange[i][0];

string cmdStr = vCmdStrRange[i];
cout << cmdStr << endl;
if (!ProcessAndCheckResults(cmdStr,
DistType, SpaceType,
vTestCases[methNum], config, *res, Print)) {
Expand All @@ -519,7 +522,6 @@ size_t RunTestExper(const vector<MethodTestCase>& vTestCases,
MetaAnalysis* res = expResKNN[i][0];

string cmdStr = vCmdStrKNN[i];
cout << cmdStr << endl;

if (!ProcessAndCheckResults(cmdStr,
DistType, SpaceType,
Expand Down

0 comments on commit 31de09d

Please sign in to comment.