Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libPostTagSystem/PostTagSearcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class PostTagSearcher::Implementation {
default:
result.conclusionReason = ConclusionReason::InvalidInput;
}
if (result.conclusionReason != ConclusionReason::NotEvaluated || parameters.includeUnevaluatedStates) {
if ((result.conclusionReason != ConclusionReason::NotEvaluated || parameters.includeUnevaluatedStates) &&
(result.conclusionReason != ConclusionReason::MergedWithAnotherInit || parameters.includeMergedStates)) {
results.push_back(result);
}
}
Expand Down
1 change: 1 addition & 0 deletions libPostTagSystem/PostTagSearcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class PostTagSearcher {
int64_t groupTimeConstraintNs = std::numeric_limits<int64_t>::max();
Checkpoints checkpoints = {};
bool includeUnevaluatedStates = false;
bool includeMergedStates = false;
};

// The functions below use two tries. One for the input checkpoints which is shared among all of them. The other trie
Expand Down
9 changes: 6 additions & 3 deletions libPostTagSystem/test/PostTagSearcher_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ void compareResults(const TagState& init,

TEST(PostTagSearcher, rangeOfTagStates) {
PostTagSearcher searcher;
const auto result = searcher.evaluateRange({{0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1}, 0},
{{0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 1},
PostTagSearcher::EvaluationParameters());

PostTagSearcher::EvaluationParameters evalParams;
evalParams.includeMergedStates = true;

const auto result = searcher.evaluateRange(
{{0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1}, 0}, {{0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 1}, evalParams);
ASSERT_EQ(result.size(), 106);

compareResults(TagState({0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1}, 0), result[48]);
Expand Down