From 3c1a8d208d4238743f5ab618e9450f02ec16e1aa Mon Sep 17 00:00:00 2001 From: koniksedy Date: Wed, 20 Nov 2024 15:25:01 +0100 Subject: [PATCH] big test --- tests/nfa/builder.cc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/nfa/builder.cc b/tests/nfa/builder.cc index 541ec861c..b75bb1770 100644 --- a/tests/nfa/builder.cc +++ b/tests/nfa/builder.cc @@ -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(std::round(final_state_density * static_cast(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(std::round(transition_density * static_cast(num_of_states))) * alphabet_size); } @@ -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(std::round(transition_density * static_cast(num_of_states))) * alphabet_size); } @@ -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(std::round(final_state_density * static_cast(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(std::round(transition_density * static_cast(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(std::round(transition_density * static_cast(num_of_states))) * alphabet_size); + + } + SECTION("Throw runtime_error. transition_density < 0") { num_of_states = 10; alphabet_size = 5;