forked from dejavudwh/Regex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix [^] semantic in nfa_set_nega_char
- Loading branch information
joeylee1997
committed
May 20, 2021
1 parent
e5c926d
commit 60a524a
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
__pycache__/ | ||
test.py | ||
.gitignore | ||
.idea | ||
*# | ||
*.iml | ||
*.ipr | ||
*.iws | ||
*.jar | ||
*.sw? | ||
*~ | ||
.#* | ||
.*.md.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import unittest | ||
from regex import Regex | ||
|
||
class RegexMaterial(object): | ||
def __init__(self, str, pattern, result): | ||
self.str = str | ||
self.pattern = pattern | ||
self.result = result | ||
|
||
testLists = [] | ||
testLists.append(RegexMaterial("a", "a", True)) | ||
testLists.append(RegexMaterial("a", "b+", False)) | ||
testLists.append(RegexMaterial("b", "b+", True)) | ||
testLists.append(RegexMaterial("ab", "(ab|cd)", True)) | ||
testLists.append(RegexMaterial("THISISREGEXTEST", "([A-Z]*|[0-9]+)", True)) | ||
testLists.append(RegexMaterial("abbbbb", "[^c]+", True)) | ||
testLists.append(RegexMaterial("ccccc", "[^c]+", False)) | ||
testLists.append(RegexMaterial("123", "[1-3]+", True)) | ||
|
||
class TestRegex(unittest.TestCase): | ||
def test(self): | ||
for t in testLists: | ||
print("str is " + t.str + ", pattern is " + t.pattern + ", expected " + str(t.result)) | ||
regex = Regex(t.str, t.pattern) | ||
self.assertEqual(regex.match(), t.result) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |