Skip to content

Commit

Permalink
Merge pull request #348 from VeriFIT/concat-fix
Browse files Browse the repository at this point in the history
Concat fix #patch
  • Loading branch information
Adda0 authored Sep 27, 2023
2 parents f58941a + e555504 commit 5331c53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/nfa/concatenation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Nfa& Nfa::concatenate(const Nfa& aut) {
return st + n;
};

this->delta.allocate(n);
this->delta.append(aut.delta.renumber_targets(upd_fnc));

// set accepting states
Expand Down
19 changes: 19 additions & 0 deletions tests/nfa/nfa-concatenation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,25 @@ TEST_CASE("mata::nfa::concatenate() inplace") {
CHECK(!result.is_lang_empty());
// TODO: Add more checks.
}

SECTION("Delta smaller than states") {
Nfa lhs{};
Nfa rhs{};

lhs.delta.add(0, 65, 5);
lhs.initial.insert(0);
lhs.initial.insert(7);
lhs.final.insert(5);
lhs.final.insert(7);

rhs.delta.add(0, 65, 7);
rhs.initial.insert(0);
rhs.final.insert(7);

Nfa result = lhs.concatenate(rhs);
CHECK(!result.is_lang_empty());
}

}

TEST_CASE("Concat_inplace performance", "[.profiling]") {
Expand Down

0 comments on commit 5331c53

Please sign in to comment.