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
4 changes: 2 additions & 2 deletions src/nft/operations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ bool Nft::is_in_lang_by_levels(const std::vector<Word>& level_words, const bool
if (level == 0 && level_target == 0) {
for (Level level_loop{ level }; level_loop < levels.num_of_levels; ++level_loop) {
if (next_words_its[level_loop] == track_words_ends[level_loop] ||
not symbols_match(*word_symbol_it, *next_words_its[level_loop])) {
not symbols_match(symbol_post_it->symbol, *next_words_its[level_loop])) {
jump_failed = true;
break;
}
Expand All @@ -1281,7 +1281,7 @@ bool Nft::is_in_lang_by_levels(const std::vector<Word>& level_words, const bool
for (Level level_loop{ level }; level_loop != level_target;
level_loop = levels.next_level_after(level_loop)) {
if (next_words_its[level_loop] == track_words_ends[level_loop] ||
not symbols_match(*word_symbol_it, *next_words_its[level_loop])) {
not symbols_match(symbol_post_it->symbol, *next_words_its[level_loop])) {
jump_failed = true;
break;
}
Expand Down
24 changes: 24 additions & 0 deletions tests/nft/nft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3418,6 +3418,30 @@ TEST_CASE("mata::nft:: create simple automata") {
CHECK(!nft.is_in_lang({ 3 }));
}

TEST_CASE("ISSUE #613 - mata::nft::nft::is_in_lang()") {
SECTION("DONT_CARE jump") {
Nft nft{ builder::create_sigma_star_nft(2) };
CHECK(nft.is_in_lang({ 'a', 'b' }));
CHECK(nft.is_in_lang({ 'a', 'a' }));
CHECK(nft.is_in_lang({ 'b', 'a' }));

Nft nft3{ builder::create_sigma_star_nft(3) };
CHECK(nft3.is_in_lang({ 'a', 'b', 'c' }));
}

SECTION("DONT_CARE in the word") {
Nft nft{ Nft::with_levels({ 2, { 0 } }, 1, { 0 }, { 0 }) };
nft.delta.add(0, 'x', 0);

CHECK(nft.is_in_lang({ 'x', 'x' }));
CHECK(nft.is_in_lang({ DONT_CARE, 'x' }));
CHECK(nft.is_in_lang({ 'x', DONT_CARE }));
CHECK(!nft.is_in_lang({ DONT_CARE, 'b' }));
CHECK(!nft.is_in_lang({ 'b', DONT_CARE }));
}
}


TEST_CASE("mata::nft::print_to_mata()") {
Nft aut_big{ Nft::with_levels(2, 9) };
aut_big.initial = { 1, 2 };
Expand Down
Loading