moved all test expression files in the test-resources forlder

This commit is contained in:
2024-06-09 16:01:47 +02:00
parent 33d70d6d1a
commit eb4b17f078
8 changed files with 27 additions and 27 deletions
+33
View File
@@ -0,0 +1,33 @@
builtin ["os.file", "base"];
readInt=func(fh){
line=fileRead(fh);
line ? [nil] {nil} :: {int(line)}
};
ds={
"init":func(filename){
fh=fileOpen(filename);
fh ? [nil] {nil} :: { @current=readInt(fh); @prev=@current };
fh
},
"current":func(){
prev
},
"next":func(fh){
current ?
[nil] {current}
:: {@prev=current; @current=readInt(fh) but current}
},
"clean":func(fh){
fileClose(fh)
}
}
//;f=$(ds, "int.list")
/*
;f++
;f++
;f++
*/
//;add(f)
+18
View File
@@ -0,0 +1,18 @@
ds={
"init":func(end){@end=end; @current=0; @prev=@current},
"current":func(){prev},
"next":func(){
(current <= end) ? [true] {@current=current+1; @prev=current} :: {nil}
},
"reset":func(){@current=0; @prev=@current}
}
// Example
//;
//it=$(ds,3);
//it++;
//it."reset"
//it++;
//it++;
//add(it)
+17
View File
@@ -0,0 +1,17 @@
/*
sample-export-all.expr: example source file
*/
@@; // Enable export all mode
// double(x): returns 2*x
double=func(x){2*x};
// Define variable 'a' wth value 5
a=5;
// two(): returns 2
two=func() {2};
// six(): returns 6
six=func() {6};
+15
View File
@@ -0,0 +1,15 @@
/*
test-funcs.expr: example source file
*/
// double(x): returns 2*x
@double=func(x){2*x};
// Define variable 'a' wth value 5
@a=5;
// two(): returns 2
@two=func() {2};
// six(): returns 6
six=func() {6};