Test on iterator filter and map

This commit is contained in:
Celestino Amoroso 2024-07-13 15:30:04 +02:00
parent d7a7b3218c
commit cde2efacf1
2 changed files with 17 additions and 2 deletions

View File

@ -23,6 +23,6 @@ func TestIteratorParser(t *testing.T) {
/* 12 */ {`include "test-resources/filter.expr"; it=$(ds,10); it++`, int64(2), nil},
}
runTestSuiteSpec(t, section, inputs, 12)
//runTestSuite(t, section, inputs)
//runTestSuiteSpec(t, section, inputs, 12)
runTestSuite(t, section, inputs)
}

View File

@ -0,0 +1,15 @@
ds={
"init":func(end){@end=end; @current=0 but true},
"current":func(){current},
"next":func(){
((next=current+1) <= end) ? [true] {@current=next but current} :: {nil}
}
, "filter":func(item,index) { item > 0 }
, "map": func(item,index) { item * 2 }
}
/* Example
;
it=$(ds,3);
add(it)
*/