mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Added _forEach and _map, added tests for them
This commit is contained in:
40
test/scripts/lib/random-stuff.toy
Normal file
40
test/scripts/lib/random-stuff.toy
Normal file
@@ -0,0 +1,40 @@
|
||||
//test this logic for memory leaks
|
||||
{
|
||||
import compound;
|
||||
import timer;
|
||||
|
||||
fn start(k, v) {
|
||||
return startTimer();
|
||||
}
|
||||
|
||||
fn check(k, v) {
|
||||
var l = v.stopTimer();
|
||||
print l.timerToString();
|
||||
l.destroyTimer();
|
||||
return v;
|
||||
}
|
||||
|
||||
fn destroy(k, v) {
|
||||
v.destroyTimer();
|
||||
}
|
||||
|
||||
var arr = [1];
|
||||
|
||||
arr
|
||||
.map(start)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(check)
|
||||
.map(destroy)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
Reference in New Issue
Block a user