diff --git a/hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java b/hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java new file mode 100644 index 00000000..e203a8dc --- /dev/null +++ b/hsregex/src/test/java/org/pgpainless/algorithm/HSRegexInterpreterFactoryTest.java @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: 2022 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +package org.pgpainless.algorithm; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class HSRegexInterpreterFactoryTest { + + @Test + public void dummyRegexTest() { + HSRegexInterpreterFactory factory = new HSRegexInterpreterFactory(); + RegexInterpreterFactory.setInstance(factory); + Regex regex = RegexInterpreterFactory.create("Alice|Bob"); + + assertTrue(regex.matches("Alice")); + assertTrue(regex.matches("Bob")); + assertFalse(regex.matches("Charlie")); + } +} diff --git a/hsregex/src/test/java/org/pgpainless/algorithm/package-info.java b/hsregex/src/test/java/org/pgpainless/algorithm/package-info.java new file mode 100644 index 00000000..5dc78706 --- /dev/null +++ b/hsregex/src/test/java/org/pgpainless/algorithm/package-info.java @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2022 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Regex interpreter implementation based on Henry Spencers Regular Expression library. + * + * @see RFC4880 - ยง8. Regular Expressions + */ +package org.pgpainless.algorithm;