-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontrol_trainsearch.py
executable file
·89 lines (67 loc) · 2.29 KB
/
control_trainsearch.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python3.10
'''
Simple runner for Train Search suite
'''
import sys
import logging
import olcbchecker.setup
import check_ts10_create
import check_ts20_partial
import check_ts30_reserved2
import check_ts40_reserved4
def prompt() :
print("\nTrain Search Standard checking")
print(" a Run all in sequence")
print(" 1 Create Train checking")
print(" 2 Partial Values checking")
print(" 3 Reserved Address Section 2 checking")
print(" 4 Reserved Address Section 4 checking")
print(" ")
print(" q go back")
def checkAll(logger=logging.getLogger("TRAIN_SEARCH")) :
result = 0
logger.info("Create Train checking")
result += check_ts10_create.check()
logger.info("Partial Values checking")
result += check_ts20_partial.check()
logger.info("Reserved Address Section 2 checking")
result += check_ts30_reserved2.check()
logger.info("Reserved Address Section 4 checking")
result += check_ts40_reserved4.check()
if result == 0 :
logger.info("Success - all Train Search checks passed")
else:
logger.warning("At least one Train Search check failed")
return result
def main() :
logger = logging.getLogger("TRAIN_SEARCH")
if olcbchecker.setup.configure.runimmediate :
return (checkAll(logger))
'''
loop to check against Train Search Standard
'''
while True :
prompt()
selection = input(">> ").lower()
match selection :
case "1" :
print("\nTrain Search checking")
check_ts10_create.check()
case "2" :
print("\nPartial Values checking")
check_ts20_partial.check()
case "3" :
print("\nReserved Address Section 2 checking")
check_ts30_reserved2.check()
case "4" :
print("\nReserved Address Section 4 checking")
check_ts40_reserved4.check()
case "a" :
checkAll(logger)
case "q" | "quit" : return
case _ : continue
return
if __name__ == "__main__":
result = main()
olcbchecker.setup.interface.close()
sys.exit(result)