-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (42 loc) · 1.32 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from state_machines import regular_expressions
def test_evenab():
print("Testing evenab function:")
test_cases = [
("abba", "accepted"),
("abb", "rejected"),
("abbaabbaba", "accepted"),
("abbaabba", "accepted"),
("abbaa", "rejected")
]
for s, expected in test_cases:
result = regular_expressions.even_ab(s)
print(f"Input: {s}, Expected: {expected}, Got: {result}")
print("-" * 40)
def test_ends_with_b():
print("Testing ends_with_b function:")
test_cases = [
("aabab", "accepted"),
("aaba", "rejected")
]
for s, expected in test_cases:
result = regular_expressions.ends_with_b(s)
print(f"Input: {s}, Expected: {expected}, Got: {result}")
print("-" * 40)
def test_contains_aba():
print("Testing contains_aba function:")
test_cases = [
("ababa", "accepted"),
("aabb", "rejected"),
("aabba", "rejected"),
("ababba", "accepted"),
("aabbbabbaba", "accepted"),
("abaaabbbabb", "accepted")
]
for s, expected in test_cases:
result = regular_expressions.contains_aba(s)
print(f"Input: {s}, Expected: {expected}, Got: {result}")
print("-" * 40)
if __name__ == "__main__":
test_evenab()
test_ends_with_b()
test_contains_aba()