-
Notifications
You must be signed in to change notification settings - Fork 49
/
test02.lua
95 lines (80 loc) · 2 KB
/
test02.lua
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
90
91
92
93
94
95
-- status: correct
-- teardown_command: rm -rf test02-lua/
-- linux: yes
-- ucrt64: yes
-- win: yes
-- mac: no
oms_setCommandLineOption("--suppressPath=true")
oms_setTempDirectory("./test02-lua/")
function printStatus(status, expected)
cmp = ""
if status == expected then
cmp = "correct"
else
cmp = "wrong"
end
if 0 == status then
status = "ok"
elseif 1 == status then
status = "warning"
elseif 3 == status then
status = "error"
end
print("status: [" .. cmp .. "] " .. status)
end
function printType(t)
if oms_system_tlm == t then
print("type: oms_system_tlm")
elseif oms_system_wc == t then
print("type: oms_system_wc")
elseif oms_system_sc == t then
print("type: oms_system_sc")
else
print("Unknown type")
end
end
status = oms_newModel("test")
printStatus(status, 0)
type, status = oms_getSystemType("test")
printType(type)
printStatus(status, 3)
status = oms_addSystem("test.eoo", oms_system_wc)
printStatus(status, 0)
status = oms_addSystem("test.eoo.foo", oms_system_sc)
printStatus(status, 0)
status = oms_addSystem("test.eoo.goo", oms_system_sc)
printStatus(status, 0)
type, status = oms_getSystemType("test")
printType(type)
printStatus(status, 3)
type, status = oms_getSystemType("test.eoo")
printType(type)
printStatus(status, 0)
type, status = oms_getSystemType("test.eoo.foo")
printType(type)
printStatus(status, 0)
type, status = oms_getSystemType("test.eoo.goo")
printType(type)
printStatus(status, 0)
status = oms_delete("test")
printStatus(status, 0)
-- Result:
-- status: [correct] ok
-- error: [oms_getSystemType] Model "test" does not contain system ""
-- Unknown type
-- status: [correct] error
-- status: [correct] ok
-- status: [correct] ok
-- status: [correct] ok
-- type: oms_system_wc
-- status: [wrong] ok
-- type: oms_system_wc
-- status: [correct] ok
-- type: oms_system_sc
-- status: [correct] ok
-- type: oms_system_sc
-- status: [correct] ok
-- status: [correct] ok
-- info: 0 warnings
-- info: 1 errors
-- endResult