Skip to content

Commit

Permalink
big test
Browse files Browse the repository at this point in the history
  • Loading branch information
koniksedy committed Nov 20, 2024
1 parent 878ad0a commit 3c1a8d2
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/nfa/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ TEST_CASE("Create Tabakov-Vardi NFA") {
CHECK(nfa.num_of_states() == num_of_states);
CHECK(nfa.initial.size() == 1);
CHECK(nfa.final.size() == static_cast<size_t>(std::round(final_state_density * static_cast<float>(num_of_states))));
CHECK(nfa.delta.get_used_symbols().size() <= alphabet_size);
CHECK(nfa.delta.get_used_symbols().size() == alphabet_size);
CHECK(nfa.delta.num_of_transitions() == static_cast<size_t>(std::round(transition_density * static_cast<float>(num_of_states))) * alphabet_size);
}

Expand All @@ -186,7 +186,7 @@ TEST_CASE("Create Tabakov-Vardi NFA") {
CHECK(nfa.num_of_states() == num_of_states);
CHECK(nfa.initial.size() == 1);
CHECK(nfa.final.size() == num_of_states);
CHECK(nfa.delta.get_used_symbols().size() <= alphabet_size);
CHECK(nfa.delta.get_used_symbols().size() == alphabet_size);
CHECK(nfa.delta.num_of_transitions() == static_cast<size_t>(std::round(transition_density * static_cast<float>(num_of_states))) * alphabet_size);
}

Expand All @@ -200,10 +200,25 @@ TEST_CASE("Create Tabakov-Vardi NFA") {
CHECK(nfa.num_of_states() == num_of_states);
CHECK(nfa.initial.size() == 1);
CHECK(nfa.final.size() == static_cast<size_t>(std::round(final_state_density * static_cast<float>(num_of_states))));
CHECK(nfa.delta.get_used_symbols().size() <= alphabet_size);
CHECK(nfa.delta.get_used_symbols().size() == alphabet_size);
CHECK(nfa.delta.num_of_transitions() == static_cast<size_t>(std::round(transition_density * static_cast<float>(num_of_states))) * alphabet_size);
}

SECTION("BIG") {
num_of_states = 1000;
alphabet_size = 100;
transition_density = 5;
final_state_density = 1;

Nfa nfa = mata::nfa::builder::create_tabakov_vardi_nfa(num_of_states, alphabet_size, transition_density, final_state_density);
CHECK(nfa.num_of_states() == num_of_states);
CHECK(nfa.initial.size() == 1);
CHECK(nfa.final.size() == num_of_states);
CHECK(nfa.delta.get_used_symbols().size() == alphabet_size);
CHECK(nfa.delta.num_of_transitions() == static_cast<size_t>(std::round(transition_density * static_cast<float>(num_of_states))) * alphabet_size);

}

SECTION("Throw runtime_error. transition_density < 0") {
num_of_states = 10;
alphabet_size = 5;
Expand Down

0 comments on commit 3c1a8d2

Please sign in to comment.