diff --git a/tests/cppaql/arbologyTest.cpp b/tests/cppaql/arbologyTest.cpp index 398b57897e199979c7b22c76d95b3447544daaaa..9482a0ff1e6476185ef02084de748f143f280368 100644 --- a/tests/cppaql/arbologyTest.cpp +++ b/tests/cppaql/arbologyTest.cpp @@ -154,9 +154,6 @@ TEST_CASE ( "Arbology tests | nonlinear pattern", "[integration]" ) { "arbology::indexing::NonlinearFullAndLinearIndexConstruction (PrefixRankedTree)$subject | arbology::query::NonlinearFullAndLinearIndexPatterns - (PrefixRankedNonlinearPattern) $pattern", 1000 ), std::make_tuple ( "Exact Nonlinear Pattern Matching Using Full And Linear Index (PrefixRankedBar)", "arbology::indexing::NonlinearFullAndLinearIndexConstruction (PrefixRankedBarTree)$subject | arbology::query::NonlinearFullAndLinearIndexPatterns - (PrefixRankedBarNonlinearPattern) $pattern", 1000 ), - std::make_tuple ( "Exact Nonlinear Tree Pattern Automaton (PrefixRankedBar)", - "arbology::exact::ExactNonlinearTreePatternAutomaton (PrefixRankedBarTree)$subject <(tree::SubtreeWildcard::get $pattern) <(tree::NonlinearAlphabet::get $pattern) <(tree::VariablesBarSymbol::get (PrefixRankedBarNonlinearPattern)$pattern) | " - "automaton::determinize::Determinize - | (SetOfObjects)automaton::run::Result - (LinearString)(PrefixRankedBarNonlinearPattern)$pattern (DefaultStateType){ :Object }", 80 ), std::make_tuple ( "Exact Pattern Match (NonlinearPattern PrefixRankedBar)", "arbology::exact::ExactPatternMatch (PrefixRankedBarTree)$subject (PrefixRankedBarNonlinearPattern) <(tree::GeneralAlphabet::add $pattern <(tree::GeneralAlphabet::get $subject))", 1000 ), std::make_tuple ( "Exact Boyer Moore Horspool (NonlinearPattern PrefixRankedBar)", @@ -187,7 +184,7 @@ TEST_CASE ( "Arbology tests | nonlinear pattern", "[integration]" ) { // -------------------------------------------------------------------------------------------------------------------- -TEST_CASE ( "Arbology tests | nonlinear pattern ends", "[integration]" ) { +TEST_CASE ( "Arbology tests | ranked nonlinear pattern ends", "[integration]" ) { auto definition = GENERATE ( as < std::tuple < std::string, std::string, size_t > > ( ), std::make_tuple ( "Exact Nonlinear Tree Pattern Automaton (PrefixRanked)", "arbology::exact::ExactNonlinearTreePatternAutomaton (PrefixRankedTree)$subject <(tree::SubtreeWildcard::get $pattern) <(tree::NonlinearAlphabet::get $pattern) | automaton::determinize::Determinize - |" @@ -213,6 +210,32 @@ TEST_CASE ( "Arbology tests | nonlinear pattern ends", "[integration]" ) { // -------------------------------------------------------------------------------------------------------------------- +TEST_CASE ( "Arbology tests | nonlinear pattern ends", "[integration]" ) { + auto definition = GENERATE ( as < std::tuple < std::string, std::string, size_t > > ( ), + std::make_tuple ( "Exact Nonlinear Tree Pattern Automaton (PrefixRankedBar)", + "arbology::exact::ExactNonlinearTreePatternAutomaton (PrefixRankedBarTree)$subject <(tree::SubtreeWildcard::get $pattern) <(tree::NonlinearAlphabet::get $pattern) <(tree::VariablesBarSymbol::get (PrefixRankedBarNonlinearPattern)$pattern) | " + "automaton::determinize::Determinize - | (SetOfObjects)automaton::run::Result - (LinearString)(PrefixRankedBarNonlinearPattern)$pattern (DefaultStateType){ :Object }", 80 ) ); + + const char * exact = "arbology::exact::ExactPatternMatch $subject $pattern"; + auto pattern = EGenerateType::NONLINEAR_PATTERN_SINGLE_VAR; + + SECTION ( "Test files" ) { + for ( const std::pair < std::string, std::string > & files : pair_pattern_subject ( TestFiles::Get ( "/tree/aarbology.test[0-9]+.nonlinear.pattern.xml$" ), ".nonlinear.pattern.xml", ".subject.xml" ) ) { + CAPTURE ( std::get < 0 > ( definition ), std::get < 1 > ( definition ), files.first, files.second ); + runTest ( exact, std::get < 1 > ( definition ), files.first, files.second ); + } + } + + SECTION ( "Random tests" ) { + for ( size_t i = 0; i < RANDOM_ITERATIONS; i++ ) { + CAPTURE ( std::get < 0 > ( definition ), std::get < 1 > ( definition ), pattern, std::get < 2 > ( definition ) ); + runRandom ( exact, std::get < 1 > ( definition ), EGenerateType::SUBJECT, pattern, std::get < 2 > ( definition ) ); + } + } +} + +// -------------------------------------------------------------------------------------------------------------------- + TEST_CASE ( "Arbology tests | pattern", "[integration]" ) { auto definition = GENERATE ( as < std::tuple < std::string, std::string, size_t > > ( ), std::make_tuple ( "Exact Pattern Matching Using Full And Linear Index (PrefixRankedBar)",