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 pathconstants test.dscript
78 lines (54 loc) · 2.27 KB
/
constants 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
## Inventory script for testing
Constant Tag Tester:
type: assignment
debug: false
default constants:
npc test constant: expected value
test script constant: expected value
in deep:
script constant: expected value
test script list constant:
- expected value 1
- expected value 2
test script grid constant:
- key_1/value 1
- key_2/value 2
Constant Tags Unit Task:
type: world
debug: false
speed: 0
events:
on server start:
- if <server.flag[unit_tasks].as_list> !contains <script>
flag server unit_tasks:->:<script>
script:
## Create necessary objects
- define output "s@Unit Test Write Output"
- run 's@Unit Test Create Output' 'd:<script.name>'
- create e@player 'constant npc' save:constantnpc
- assignment 'npc:<entry[constantnpc].created_npc>' set 's@constant tag tester'
## Test script constants
- run "s@Unit Test Set Prefix" 'def:script constants'
- if '<s@constant tag tester.constant[test script constant]>' == 'expected value'
run %output% 'def:element value|Pass'
else run %output% 'def:element value|Fail'
- if '<s@constant tag tester.constant[in deep.script constant]>' == 'expected value'
run %output% 'def:deep element value|Pass'
else run %output% 'def:deep element value|Fail'
- if '<s@constant tag tester.constant[test script list constant]>' == 'li@expected value 1|expected value 2'
run %output% 'def:list value|Pass'
else run %output% 'def:list value value|Fail'
- if '<s@constant tag tester.constant[test script grid constant].get_sub_items[1]>' == 'li@key_1|key_2'
run %output% 'def:grid value|Pass'
else run %output% 'def:grid value|Fail'
## Test npc constants
- run "s@Unit Test Set Prefix" 'def:npc constants'
- if '<entry[constantnpc].created_npc.constant[npc test constant]>' == 'expected value'
run %output% def:default|Pass
else run %output% def:default|Fail
- execute as_server "npc sel <entry[constantnpc].created_npc.id>"
- execute as_server "npc constants --set 'npc test constant' --value 'new expected value'"
- if '<entry[constantnpc].created_npc.constant[npc test constant]>' == 'new expected value'
run %output% def:override|Pass
else run %output% def:override|Fail
- remove '<entry[constantnpc].created_npc>'