285 |
.expectRealExitResult = 6.9 |
.expectRealExitResult = 6.9 |
286 |
}); |
}); |
287 |
|
|
288 |
|
// int array tests ... |
289 |
|
|
290 |
|
runScript({ |
291 |
|
.code = R"NKSP_CODE( |
292 |
|
on init |
293 |
|
declare %foo[3] |
294 |
|
%foo[0] := 21 |
295 |
|
exit(%foo[0]) |
296 |
|
end on |
297 |
|
)NKSP_CODE", |
298 |
|
.expectIntExitResult = 21 |
299 |
|
}); |
300 |
|
|
301 |
|
runScript({ |
302 |
|
.code = R"NKSP_CODE( |
303 |
|
on init |
304 |
|
declare %foo[3] := ( 12, 23, 34 ) |
305 |
|
exit(%foo[0]) |
306 |
|
end on |
307 |
|
)NKSP_CODE", |
308 |
|
.expectIntExitResult = 12 |
309 |
|
}); |
310 |
|
|
311 |
|
runScript({ |
312 |
|
.code = R"NKSP_CODE( |
313 |
|
on init |
314 |
|
declare %foo[3] := ( 12, 23, 34 ) |
315 |
|
exit(%foo[1]) |
316 |
|
end on |
317 |
|
)NKSP_CODE", |
318 |
|
.expectIntExitResult = 23 |
319 |
|
}); |
320 |
|
|
321 |
|
runScript({ |
322 |
|
.code = R"NKSP_CODE( |
323 |
|
on init |
324 |
|
declare %foo[3] := ( 12, 23, 34 ) |
325 |
|
exit(%foo[2]) |
326 |
|
end on |
327 |
|
)NKSP_CODE", |
328 |
|
.expectIntExitResult = 34 |
329 |
|
}); |
330 |
|
|
331 |
|
runScript({ // make sure array is entirely initialized with zeroes |
332 |
|
.code = R"NKSP_CODE( |
333 |
|
on init |
334 |
|
declare $i |
335 |
|
declare $result |
336 |
|
declare %foo[100] |
337 |
|
while ($i < 100) |
338 |
|
$result := $result .or. %foo[$i] |
339 |
|
inc($i) |
340 |
|
end while |
341 |
|
exit($result) |
342 |
|
end on |
343 |
|
)NKSP_CODE", |
344 |
|
.expectIntExitResult = 0 |
345 |
|
}); |
346 |
|
|
347 |
|
// real array tests ... |
348 |
|
|
349 |
|
runScript({ |
350 |
|
.code = R"NKSP_CODE( |
351 |
|
on init |
352 |
|
declare ?foo[3] |
353 |
|
?foo[0] := 34.9 |
354 |
|
exit(?foo[0]) |
355 |
|
end on |
356 |
|
)NKSP_CODE", |
357 |
|
.expectRealExitResult = 34.9 |
358 |
|
}); |
359 |
|
|
360 |
|
runScript({ |
361 |
|
.code = R"NKSP_CODE( |
362 |
|
on init |
363 |
|
declare ?foo[3] := ( 0.3, 23.5, 900.1 ) |
364 |
|
exit(?foo[0]) |
365 |
|
end on |
366 |
|
)NKSP_CODE", |
367 |
|
.expectRealExitResult = 0.3 |
368 |
|
}); |
369 |
|
|
370 |
|
runScript({ |
371 |
|
.code = R"NKSP_CODE( |
372 |
|
on init |
373 |
|
declare ?foo[3] := ( 0.3, 23.5, 900.1 ) |
374 |
|
exit(?foo[1]) |
375 |
|
end on |
376 |
|
)NKSP_CODE", |
377 |
|
.expectRealExitResult = 23.5 |
378 |
|
}); |
379 |
|
|
380 |
|
runScript({ |
381 |
|
.code = R"NKSP_CODE( |
382 |
|
on init |
383 |
|
declare ?foo[3] := ( 0.3, 23.5, 900.1 ) |
384 |
|
exit(?foo[2]) |
385 |
|
end on |
386 |
|
)NKSP_CODE", |
387 |
|
.expectRealExitResult = 900.1 |
388 |
|
}); |
389 |
|
|
390 |
|
runScript({ // make sure array is entirely initialized with zeroes |
391 |
|
.code = R"NKSP_CODE( |
392 |
|
on init |
393 |
|
declare $i |
394 |
|
declare ?foo[100] |
395 |
|
while ($i < 100) |
396 |
|
if (?foo[$i] # 0.0) |
397 |
|
exit(-1) { test failed } |
398 |
|
end if |
399 |
|
inc($i) |
400 |
|
end while |
401 |
|
exit(0) { test succeeded } |
402 |
|
end on |
403 |
|
)NKSP_CODE", |
404 |
|
.expectIntExitResult = 0 |
405 |
|
}); |
406 |
|
|
407 |
// std unit tests ... |
// std unit tests ... |
408 |
|
|
409 |
runScript({ |
runScript({ |