forked from OurHike/OurHike
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgain_vectors.json
More file actions
315 lines (315 loc) · 6.65 KB
/
Copy pathgain_vectors.json
File metadata and controls
315 lines (315 loc) · 6.65 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
{
"_README": [
"Cumulative-ascent test vectors, read by BOTH implementations:",
"",
" pipeline/tests/test_lib_elevation_gain.py (Python)",
" client/src/lib/elevationGain.test.ts (TypeScript)",
"",
"The algorithm exists twice because it is asked two different questions -",
"the pipeline asks once about the whole trail, the app asks about a window",
"that moves as a hiker walks - and two implementations of one number drift.",
"Not gradually and visibly, either: they drift the first time someone fixes",
"an edge case in one language and does not think to open the other file.",
"",
"Shared vectors turn that into a failing test in whichever language was not",
"updated, which is the only mechanism here that does not rely on remembering.",
"",
"Elevations are unitless; each case carries its own threshold in the same",
"unit. Add a case by adding it here - both suites pick it up with no code",
"unit. Add a case by adding it here - both suites pick it up with no code",
"change in either.",
"",
"`boundary_cases` are the third kind of break (#559), and they carry",
"`samples` rather than `elevations` because the marker lives on a record.",
"A centerline part boundary is not a DEM gap: the measurement is fine and",
"the TRAIL is discontinuous, so the step across it is not a slope anybody",
"walks. The pipeline carries the distance axis straight over that space,",
"which is how ~36,800 ft of phantom climb reached the published total."
],
"cases": [
{
"name": "a single climb counts its whole rise",
"elevations": [
100,
200,
300,
400
],
"threshold": 3,
"expected_gain": 300
},
{
"name": "every separate climb in a rolling profile counts",
"elevations": [
0,
100,
50,
150,
100,
200
],
"threshold": 3,
"expected_gain": 300
},
{
"name": "flat ground with DEM jitter has no gain",
"elevations": [
1000,
1000.4,
999.3,
1000.2,
999.7,
1000.6,
999.5,
1000.1
],
"threshold": 3,
"expected_gain": 0
},
{
"name": "a swing just under the threshold is dropped whole",
"elevations": [
100,
102.9,
100,
102.9,
100
],
"threshold": 3,
"expected_gain": 0
},
{
"name": "a swing just over the threshold is kept whole",
"elevations": [
100,
103.1,
100,
103.1
],
"threshold": 3,
"expected_gain": 6.2
},
{
"name": "a gentle climb below the step size still counts",
"elevations": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
],
"threshold": 3,
"expected_gain": 10
},
{
"name": "a pure descent has no gain",
"elevations": [
500,
400,
300,
200,
100
],
"threshold": 3,
"expected_gain": 0
},
{
"name": "a climb the profile ends on is counted",
"elevations": [
0,
100,
50,
400
],
"threshold": 3,
"expected_gain": 450
},
{
"name": "a climb is measured from the true low, not the first sample",
"elevations": [
100,
98,
500
],
"threshold": 3,
"expected_gain": 402
},
{
"name": "a zero threshold is the raw sum this replaces",
"elevations": [
100,
101,
100,
101
],
"threshold": 0,
"expected_gain": 2
},
{
"name": "no samples",
"elevations": [],
"threshold": 3,
"expected_gain": 0
},
{
"name": "one sample cannot have climbed",
"elevations": [
42
],
"threshold": 3,
"expected_gain": 0
}
],
"gap_cases": [
{
"name": "a DEM gap is not bridged into a climb",
"elevations": [
100,
110,
null,
3000,
3010
],
"threshold": 3,
"expected_gain": 20
},
{
"name": "each side of a gap is still measured",
"elevations": [
0,
500,
null,
0,
500
],
"threshold": 3,
"expected_gain": 1000
},
{
"name": "a profile that is entirely nulls has no gain",
"elevations": [
null,
null,
null
],
"threshold": 3,
"expected_gain": 0
}
],
"boundary_cases": [
{
"name": "a part boundary is not summed as a climb",
"samples": [
{
"elevation_ft": 100
},
{
"elevation_ft": 110
},
{
"elevation_ft": 3000,
"part_start": true
},
{
"elevation_ft": 3010
}
],
"threshold": 3,
"expected_gain": 20
},
{
"name": "each side of a boundary is still measured on its own",
"samples": [
{
"elevation_ft": 0
},
{
"elevation_ft": 500
},
{
"elevation_ft": 0
},
{
"elevation_ft": 9000,
"part_start": true
},
{
"elevation_ft": 9400
},
{
"elevation_ft": 9000
}
],
"threshold": 3,
"expected_gain": 900
},
{
"name": "a marker on the first sample changes nothing",
"samples": [
{
"elevation_ft": 100,
"part_start": true
},
{
"elevation_ft": 200
},
{
"elevation_ft": 300
}
],
"threshold": 3,
"expected_gain": 200
},
{
"name": "a profile with no markers is one run, as an older artifact is read",
"samples": [
{
"elevation_ft": 100
},
{
"elevation_ft": 110
},
{
"elevation_ft": 3000
}
],
"threshold": 3,
"expected_gain": 2900
},
{
"name": "a boundary and a DEM gap both break the run",
"samples": [
{
"elevation_ft": 100
},
{
"elevation_ft": 200
},
{
"elevation_ft": null
},
{
"elevation_ft": 5000
},
{
"elevation_ft": 5100
},
{
"elevation_ft": 9000,
"part_start": true
},
{
"elevation_ft": 9100
}
],
"threshold": 3,
"expected_gain": 300
}
]
}