From d6e77b6e890bcc7203250aac916f4e3ea7b96a95 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Mon, 27 Apr 2020 10:52:45 +0200
Subject: [PATCH] the generated subject tree should be longer than the pattern

---
 alib2integrationtest/test-src/tests/exactMatching.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/alib2integrationtest/test-src/tests/exactMatching.cpp b/alib2integrationtest/test-src/tests/exactMatching.cpp
index 8266d4a16e..7e6119a75b 100644
--- a/alib2integrationtest/test-src/tests/exactMatching.cpp
+++ b/alib2integrationtest/test-src/tests/exactMatching.cpp
@@ -13,10 +13,10 @@ static std::string qExtendAlphabet ( const std::string & s1, const std::string &
 	return "execute string::GeneralAlphabet::add $" + s1 + " <( string::GeneralAlphabet::get $" + s2 + " )";
 }
 
-static std::string qGenString ( const size_t & len, const size_t &alph_len, const std::string & var ) {
+static std::string qGenString ( size_t min_len, size_t max_len, size_t alph_len, const std::string & var ) {
 	std::ostringstream oss;
 	oss << "execute string::generate::RandomStringFactory ";
-	oss << "( size_t )" << rand ( ) % len + 1;
+	oss << "( size_t )" << rand ( ) % ( max_len - min_len + 1 ) + min_len + 1;
 	oss << "( size_t )" << rand ( ) % alph_len + 1;
 	oss << "true | ";
 	oss << "string::simplify::NormalizeAlphabet - > $" + var;
@@ -68,8 +68,8 @@ TEST_CASE ( "ExactMatching", "[integration]" ) {
 	SECTION ( "Random tests" ) {
 		for ( size_t i = 0; i < RANDOM_ITERATIONS; i++ ) {
 			ext::vector < std::string > qs = {
-				qGenString ( PATTERN_SIZE, ALPHABET_SIZE, "pattern" ),
-				qGenString ( SUBJECT_SIZE, ALPHABET_SIZE, "subject" ),
+				qGenString ( 0, PATTERN_SIZE, ALPHABET_SIZE, "pattern" ),
+				qGenString ( PATTERN_SIZE, SUBJECT_SIZE, ALPHABET_SIZE, "subject" ),
 				"execute stringology::exact::ExactFactorMatch $subject $pattern > $res1"
 			};
 
-- 
GitLab