Skip to content

Commit ea6c68f

Browse files
committed
added test with different prime number q
1 parent 8b8cc1d commit ea6c68f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/test/java/com/thealgorithms/searches/RabinKarpAlgorithmTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
class RabinKarpAlgorithmTest {
99
RabinKarpAlgorithm RKA = new RabinKarpAlgorithm();
10-
int q = 101;
1110

1211
@ParameterizedTest
1312
@CsvSource(
1413
{
15-
"This is an example for rabin karp algorithmn, algorithmn",
16-
"AAABBDDG, AAA",
17-
"AAABBCCBB, BBCC",
18-
"AAAABBBBCCC, CCC",
19-
"ABCBCBCAAB, AADB"
14+
"This is an example for rabin karp algorithmn, algorithmn, 101",
15+
"AAABBDDG, AAA, 137",
16+
"AAABBCCBB, BBCC, 131",
17+
"AAAABBBBCCC, CCC, 41",
18+
"ABCBCBCAAB, AADB, 293",
19+
"Algorithm The Algorithm, Algorithm, 101"
2020
}
2121
)
22-
void RabinKarpAlgorithmTestExample(String txt, String pat) {
22+
void RabinKarpAlgorithmTestExample(String txt, String pat, int q) {
2323
int indexFromOurAlgorithm = RKA.search(pat, txt, q);
2424
int indexFromLinearSearch = txt.indexOf(pat);
2525
assertEquals(indexFromOurAlgorithm, indexFromLinearSearch);

0 commit comments

Comments
 (0)