-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp5_dfa_testing.py
54 lines (40 loc) · 1.94 KB
/
p5_dfa_testing.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
def dfaTesting(id_A, num_B, semicolon_C, and_D, while_E):
print("\n*** (a) ID DFA ***\n")
print("✅ Accept tests:")
print("XY1290a\t" + str(id_A.accepts_input('XY1290abc')))
print("nMi23\t" + str(id_A.accepts_input('nMi23')))
print("Rekl893\t" + str(id_A.accepts_input('Rekl893')))
print("❌ Reject tests:")
print("1329nc\t" + str(id_A.accepts_input('1329nc')))
print("984op\t" + str(id_A.accepts_input('984op')))
print("874kpm\t" + str(id_A.accepts_input('874kpmnd')))
print("\n*** (b) NUM DFA ***\n")
print("✅ Accept tests:")
print("123456\t" + str(num_B.accepts_input('123456')))
print("7890\t" + str(num_B.accepts_input('7890')))
print("133337\t" + str(num_B.accepts_input('133337')))
print("❌ Reject tests:")
print("pspsps\t" + str(num_B.accepts_input('pspsps')))
print("abcdef\t" + str(num_B.accepts_input('abcdef')))
print("zyxwvu\t" + str(num_B.accepts_input('zyxwvu')))
print("\n*** (c) SEMICOLON DFA ***\n")
print("✅ Accept tests:")
print(";\t" + str(semicolon_C.accepts_input(';')))
print("❌ Reject tests:")
print("!@#$%9\t" + str(semicolon_C.accepts_input('!@#$%^')))
print("&*())\t" + str(semicolon_C.accepts_input('&*())')))
print("asdfgh\t" + str(semicolon_C.accepts_input('asdfgh')))
print("\n*** (d) AND DFA ***\n")
print("✅ Accept tests:")
print("&&\t" + str(and_D.accepts_input('&&')))
print("❌ Reject tests:")
print("lorem\t" + str(and_D.accepts_input('lorem')))
print("ipsum\t" + str(and_D.accepts_input('ipsum')))
print("dolor\t" + str(and_D.accepts_input('dolor')))
print("\n*** (e) WHILE DFA ***\n")
print("✅ Accept tests:")
print("while\t" + str(while_E.accepts_input('while')))
print("❌ Reject tests:")
print("123abc\t" + str(while_E.accepts_input('123abc')))
print("956cuh\t" + str(while_E.accepts_input('956cuh')))
print("python\t" + str(while_E.accepts_input('python')))