mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 11:16:29 +03:00
castle, lbr: native report remap
This commit is contained in:
committed by
Matthew Barr
parent
ec985a62f8
commit
c101beb541
@@ -49,6 +49,8 @@ using namespace std;
|
||||
using namespace testing;
|
||||
using namespace ue2;
|
||||
|
||||
static constexpr u32 MATCH_REPORT = 1024;
|
||||
|
||||
struct LbrTestParams {
|
||||
CharReach reach;
|
||||
u32 min;
|
||||
@@ -98,10 +100,11 @@ protected:
|
||||
|
||||
ASSERT_TRUE(isLBR(*g, grey));
|
||||
|
||||
vector<vector<CharReach> > triggers;
|
||||
triggers.push_back(vector<CharReach>());
|
||||
triggers.back().push_back(CharReach::dot()); /* lbr triggered by . */
|
||||
nfa = constructLBR(*g, triggers, cc);
|
||||
rm.setProgramOffset(0, MATCH_REPORT);
|
||||
|
||||
/* LBR triggered by dot */
|
||||
vector<vector<CharReach>> triggers = {{CharReach::dot()}};
|
||||
nfa = constructLBR(*g, triggers, cc, rm);
|
||||
ASSERT_TRUE(nfa != nullptr);
|
||||
|
||||
full_state = aligned_zmalloc_unique<char>(nfa->scratchStateSize);
|
||||
@@ -247,7 +250,7 @@ TEST_P(LbrTest, QueueExecToMatch) {
|
||||
char rv = nfaQueueExecToMatch(nfa.get(), &q, end);
|
||||
ASSERT_EQ(MO_MATCHES_PENDING, rv);
|
||||
ASSERT_EQ(0, matches);
|
||||
ASSERT_NE(0, nfaInAcceptState(nfa.get(), 0, &q));
|
||||
ASSERT_NE(0, nfaInAcceptState(nfa.get(), MATCH_REPORT, &q));
|
||||
nfaReportCurrentMatches(nfa.get(), &q);
|
||||
ASSERT_EQ(1, matches);
|
||||
}
|
||||
|
Reference in New Issue
Block a user