This repository has been archived by the owner on Jul 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinjection unit test.dscript
61 lines (47 loc) · 1.8 KB
/
injection unit test.dscript
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
Injection Unit Test:
type: world
debug: false
speed: 1
events:
on server start:
- if <server.flag[unit_tasks].as_list> !contains <script> flag server unit_tasks:->:<script>
scro:
- flag global injection_unit_test_data:->:SCRO
script:
- ^define output "s@Unit Test Write Output"
- run 's@Unit Test Create Output' 'd:<script.name>'
- ^run "s@Unit Test Set Prefix" 'def:loopish blob'
- ^flag global injection_unit_test_data:!
# Test instant things
- ^repeat 3 {
- flag global injection_unit_test_data:->:%value%
- flag global injection_unit_test_data:->:Affirm
- repeat 2 {
- flag global injection_unit_test_data:->:sub_%value%
- if true {
- flag global injection_unit_test_data:->:up
- inject locally path:scro
}
else {
- flag global injection_unit_test_data:->:down
}
}
}
- ^flag global injection_unit_test_data:->:complete
- ^flag global injection_unit_test_data:->:definite
- ^if '<global.flag[injection_unit_test_data].as_list>' ==
'li@1|Affirm|sub_1|up|SCRO|sub_2|up|SCRO|2|Affirm|sub_1|up|SCRO|sub_2|up|SCRO|3|Affirm|sub_1|up|SCRO|sub_2|up|SCRO|complete|definite'
run %output% 'def:Loop ran perfectly|Pass'
else run %output% 'def:Loop ran perfectly|Fail'
# Test things that should or shouldn't delay
- ^run "s@Unit Test Set Prefix" 'def:timing'
- ^define time <server.current_time_millis>
- ^if <server.current_time_millis.sub[%time%]> < 50
run %output% 'def:Instant|Pass'
else run %output% 'def:Instant|Fail'
- ^define time <server.current_time_millis>
- ^wait 1s
- ^if <server.current_time_millis.sub[%time%]> > 1000
run %output% 'def:Delayed|Pass'
else run %output% 'def:Delayed|Fail'
- ^run 's@Unit Test Create Output' 'd:<script.name>'