-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.nls
More file actions
191 lines (146 loc) · 5.64 KB
/
tests.nls
File metadata and controls
191 lines (146 loc) · 5.64 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
to test-lists
let neighbor-list [self] of neighbors
show neighbor-list
end
to test-exit-preference ; demonstrates whether straight exit preference works
ask one-of people [show preferredexit] ; tests preferredexit, closest
end ;visual test
to test-direction
ask one-of people [preferreddirection show goal]
; which exit they are heading to
end
to test-closest-visible ; demonstrates whether exit preference works for visibility
ask one-of people with [visited? = false] [show preferredexit] ; tests closestvisible, preferredexit
end ;visual test
to test-soclink ; demonstrates whether soclink works
ask one-of people with [group-type != 0] [show link-neighbors] ; tests soclink for all people who came with groups
end
to tests-not-run
; the fire, people, building, and smoke are all read in from csvs
; the fact that anything shows up on setup and when things start shows that they work
; go procedure is tested whenever the go button is hit
; recolor-patches is demonstrated on 'go' and can be assessed visually
; die-by-fire and exit-building both print messages, and so can be assessed visually
end
to test-fire-distance ; shows the results of fire-distance
ask one-of people [show fire-distance] ; might be a bug? returns positive for some people even at 0 ticks
end
to test-speed-limit ; tests that individuals have been assigned a speed limit
ask one-of people [show speed-limit] ; should return a positive number smaller than 1.3
end ; making it an individual property rather than a global allows for later inclusion of information that would impact speed such as disability or age
;to test-see ; tests both the see command and the vision parameter
; ask one-of people [see show vision] ; should return an agentset that fluctuates with smoke
;end
to assert-equal [actual expected test-description]
ifelse actual = expected
[ show sentence "passed: " test-description]
[
show sentence "failed: " test-description
;show sentence "actual" actual
;show sentence "expected" expected
]
end
;to test-crowd-at-exit ; tests the number of people between a person and the exit they're aiming for
; ask one-of people [show crowd-at-exit] ; should always be a whole positive number
;end
;__________________________________________________________________________________________________________________________
;;WORKS AS INTENDED
to test-move
ask one-of people [show "is this person moving?"
show speed > 0]
; return true if they move
end
;;WORKS AS INTENDED
to test-crowdedness
ask one-of patches [ show "people with group Type 0:"
show count people with [group-type = 0]
show "people with group type 1:"
show count people with [group-type = 1]
show "people with group type 2:"
show count people with [group-type = 2]
show "people with group type 3:"
show count people with [group-type = 3]
show "people with group type 4:"
show count people with [group-type = 4]
show "people with group type 5:"
show count people with [group-type = 5]
]
;look over, patches
;shows the count of people in group
end
;;WORKS AS INTENDED
to test-set-fh
;should return integer > 0
ask one-of people [show fh
show "Is fh greater than 0?"
show fh > 0]
end
;;WORKS AS INTENDED
to test-set-speed
ask one-of people [show "what is the speed?"
show speed
show "Is the speed smaller then the speed limit?"
show speed < speed-limit]
; should return a positive integer that is less than speed limit
end
;;WORKS AS INTENDED
to test-group-heuristic
; return positive integer
ask one-of people [show group-heuristic
show "Is the heuristic positve?"
show group-heuristic > 0]
end
;;WORKS AS INTENDED
to test-prioritize-group
; tests whether hureistic > threshold
; should return true if hureistic > threshold
ask one-of people [show group-heuristic > threshold]
end
;;WORKS AS INTENDED
to test-alert
ask one-of people [ show "People are alarmed?"
show alarmed? = True ];
end
;SHOWS NEXT PATCH
to test-set-path
ask one-of people [ show next-desired-patch]
end
;WORKS AS INTENDED BUT LEADERSHIP SCORE IS CONSISTENTLY 0
to test-set-leadership
ask one-of people [show gender
show leadership-quality
show "Has Visited?"
show visited? ]
; show leadership score
;show gender
;show whether they visited before
end
to test-leader-goals
if ((goal = nobody) or (all? link-neighbors [distance myself < (21 * scale-modifier)])) = true
[show true]
end
;______________________________________________________________________________________________________________________________
to test-total-expected-cost [#goal]
ask one-of people [ show "is the total cost greater than 0?"
show Cost-path + heuristic #goal > 0
show cost-path + heuristic #goal]
;testing
; want to show a positive integer
end
to test-heuristic [#goal] ; this works as expected
ask one-of people [show fh + distance #Goal > 0
show heuristic #goal != total-expected-cost #goal]
; part of
; want to show a positive integer seperate from total expected
end
;;____________________________________________________________________________________________________________________________
to test-leader-follower ; you need to activate it - probably run preferreddirection first, then do ask one-of people
; let close-group link-neighbors with [distance myself < (20 * scale-modifier)]
show count people with [leader = true] in-radius close-group
;closegroup is local variable
; should return only one leader in closegroup
end
to test-intersects-here [ variety]
; return true if interesct with inatimate objects
ask one-of people [ show variety with [intersects-here variety ]]
end