test drivers improvements
This commit is contained in:
parent
cdaa86b9a0
commit
25e3f39f81
@ -72,8 +72,7 @@ public:
|
|||||||
}
|
}
|
||||||
cout << "}, ";
|
cout << "}, ";
|
||||||
}
|
}
|
||||||
cout << "} slack: " << tgp.slack << " kind " <<
|
cout << "} slack: " << tgp.slack << " kind " << valToString(kindflags, tgp.kind) << endl;
|
||||||
valToString(kindflags, tgp.kind) << endl;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "readfile.h"
|
#include "readfile.h"
|
||||||
|
#include "smallut.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -50,7 +51,8 @@ static string usage =
|
|||||||
" plaintorich [opts] [filename]\n"
|
" plaintorich [opts] [filename]\n"
|
||||||
" -H : input is html\n"
|
" -H : input is html\n"
|
||||||
" -L <loglevel> : set log level 0-6\n"
|
" -L <loglevel> : set log level 0-6\n"
|
||||||
" -t term : add term to match. Must in index form (lowercase/unac)\n";
|
" -t term : add term or group to match. Must in index form (lowercase/unac)\n"
|
||||||
|
" Omit filename to read from stdin\n";
|
||||||
;
|
;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -106,7 +108,23 @@ int main(int argc, char **argv)
|
|||||||
case 't': {
|
case 't': {
|
||||||
if (argc < 2) Usage();
|
if (argc < 2) Usage();
|
||||||
HighlightData::TermGroup tg;
|
HighlightData::TermGroup tg;
|
||||||
tg.term = *(++argv); argc--;
|
string in = *(++argv); argc--;
|
||||||
|
// Note that this is not exactly how the query processor would split the group, but
|
||||||
|
// it should be enough for generating groups for testing.
|
||||||
|
vector<string> vterms;
|
||||||
|
stringToTokens(in, vterms);
|
||||||
|
if (vterms.size() == 1) {
|
||||||
|
cerr << "SINGLE TERM\n";
|
||||||
|
tg.term = in;
|
||||||
|
hldata.ugroups.push_back(vector<string>{in});
|
||||||
|
} else {
|
||||||
|
for (const auto& term : vterms) {
|
||||||
|
tg.orgroups.push_back(vector<string>{term});
|
||||||
|
}
|
||||||
|
tg.slack = 0;
|
||||||
|
tg.kind = HighlightData::TermGroup::TGK_NEAR;
|
||||||
|
hldata.ugroups.push_back(vterms);
|
||||||
|
}
|
||||||
hldata.index_term_groups.push_back(tg);
|
hldata.index_term_groups.push_back(tg);
|
||||||
goto b1;
|
goto b1;
|
||||||
}
|
}
|
||||||
@ -139,10 +157,9 @@ int main(int argc, char **argv)
|
|||||||
if (ishtml) {
|
if (ishtml) {
|
||||||
hiliter.set_inputhtml(true);
|
hiliter.set_inputhtml(true);
|
||||||
}
|
}
|
||||||
|
std::cout << "Using hldata: " << hldata.toString() << "\n";
|
||||||
std::list<std::string> result;
|
std::list<std::string> result;
|
||||||
hiliter.plaintorich(inputdata, result, hldata);
|
hiliter.plaintorich(inputdata, result, hldata);
|
||||||
std::cout << *result.begin() << "\n";
|
std::cout << *result.begin() << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user