new testing infrastructure

This commit is contained in:
Francesco Cozzuto
2023-01-22 02:22:44 +01:00
parent 533cf01920
commit 1780826a97
145 changed files with 1432 additions and 938 deletions
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 + 7;
@bytecode
PUSHINT 1;
PUSHINT 7;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 - 7;
@bytecode
PUSHINT 1;
PUSHINT 7;
SUB;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 * 7;
@bytecode
PUSHINT 1;
PUSHINT 7;
MUL;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 / 7;
@bytecode
PUSHINT 1;
PUSHINT 7;
DIV;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1.0 + 7;
@bytecode
PUSHFLT 1.0;
PUSHINT 7;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1.0 - 7;
@bytecode
PUSHFLT 1.0;
PUSHINT 7;
SUB;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1.0 * 7;
@bytecode
PUSHFLT 1.0;
PUSHINT 7;
MUL;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1.0 / 7;
@bytecode
PUSHFLT 1.0;
PUSHINT 7;
DIV;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 + 7.0;
@bytecode
PUSHINT 1;
PUSHFLT 7.0;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 - 7.0;
@bytecode
PUSHINT 1;
PUSHFLT 7.0;
SUB;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 * 7.0;
@bytecode
PUSHINT 1;
PUSHFLT 7.0;
MUL;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 / 7.0;
@bytecode
PUSHINT 1;
PUSHFLT 7.0;
DIV;
POP 1;
EXIT;
@@ -0,0 +1,17 @@
@type [compiler]
@source
1 + 2 * 3;
@bytecode
PUSHINT 1;
PUSHINT 2;
PUSHINT 3;
MUL;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,17 @@
@type [compiler]
@source
1 * 2 + 3;
@bytecode
PUSHINT 1;
PUSHINT 2;
MUL;
PUSHINT 3;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,17 @@
@type [compiler]
@source
(1 + 2) * 3;
@bytecode
PUSHINT 1;
PUSHINT 2;
ADD;
PUSHINT 3;
MUL;
POP 1;
EXIT;
@@ -0,0 +1,15 @@
@type [compiler]
@source
1 + (2 * 3);
@bytecode
PUSHINT 1;
PUSHINT 2;
PUSHINT 3;
MUL;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,20 @@
@type [compiler]
@source
1 * 2 * 3 * 4;
@bytecode
PUSHINT 1;
PUSHINT 2;
MUL;
PUSHINT 3;
MUL;
PUSHINT 4;
MUL;
POP 1;
EXIT;
@@ -0,0 +1,17 @@
@type [compiler]
@source
1 * (2 * (3 * 4));
@bytecode
PUSHINT 1;
PUSHINT 2;
PUSHINT 3;
PUSHINT 4;
MUL;
MUL;
MUL;
POP 1;
EXIT;
@@ -0,0 +1,17 @@
@type [compiler]
@source
1 + 2 * 3 + 4;
@bytecode
PUSHINT 1;
PUSHINT 2;
PUSHINT 3;
MUL;
ADD;
PUSHINT 4;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,20 @@
@type [compiler]
@source
1 * 2 + 3 * 4;
@bytecode
PUSHINT 1;
PUSHINT 2;
MUL;
PUSHINT 3;
PUSHINT 4;
MUL;
ADD;
POP 1;
EXIT;
@@ -0,0 +1,24 @@
@type [compiler]
@source
A - B - C;
A - B * C;
@bytecode
PUSHVAR "A";
PUSHVAR "B";
SUB;
PUSHVAR "C";
SUB;
POP 1;
PUSHVAR "A";
PUSHVAR "B";
PUSHVAR "C";
MUL;
SUB;
POP 1;
EXIT;
@@ -0,0 +1,16 @@
@type [compiler]
@source
# This comment is because there
# can't be a '[' right before a
# tag.
[1];
@bytecode
PUSHLST 1;
PUSHINT 0;
PUSHINT 1;
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,22 @@
@type [compiler]
@source
# This comment is because there
# can't be a '[' right before a
# tag.
[true, false];
@bytecode
PUSHLST 2;
PUSHINT 0;
PUSHTRU;
INSERT;
PUSHINT 1;
PUSHFLS;
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,12 @@
@type [compiler]
@source
var = none;
@bytecode
PUSHNNE;
ASS "var";
POP 1;
EXIT;
@@ -0,0 +1,14 @@
@type [compiler]
@source
var[key] = none;
@bytecode
PUSHNNE;
PUSHVAR "var";
PUSHVAR "key";
INSERT2;
POP 1;
EXIT;
@@ -0,0 +1,18 @@
@type [compiler]
@source
A, B = func();
@bytecode
PUSHVAR "func";
CALL 0, 2;
ASS "B";
POP 1;
ASS "A";
POP 1;
EXIT;
@@ -0,0 +1,14 @@
@type [compiler]
@source
var.key = none;
@bytecode
PUSHNNE;
PUSHVAR "var";
PUSHSTR "key";
INSERT2;
POP 1;
EXIT;
@@ -0,0 +1,19 @@
@type [compiler]
@source
1 and 2;
@bytecode
PUSHINT 1;
JUMPIFNOTANDPOP false;
PUSHINT 2;
JUMPIFNOTANDPOP false;
PUSHTRU;
JUMP end;
false:
PUSHFLS;
end:
POP 1;
EXIT;
@@ -0,0 +1,19 @@
@type [compiler]
@source
1 or 2;
@bytecode
PUSHINT 1;
JUMPIFANDPOP true;
PUSHINT 2;
JUMPIFANDPOP true;
PUSHFLS;
JUMP end;
true:
PUSHTRU;
end:
POP 1;
EXIT;
@@ -0,0 +1,35 @@
@type [compiler]
@source
A and B or C and D;
@bytecode
PUSHVAR "A";
JUMPIFNOTANDPOP false_0;
PUSHVAR "B";
JUMPIFNOTANDPOP false_0;
PUSHTRU;
JUMP end_0;
false_0:
PUSHFLS;
end_0:
JUMPIFANDPOP true_2;
PUSHVAR "C";
JUMPIFNOTANDPOP false_1;
PUSHVAR "D";
JUMPIFNOTANDPOP false_1;
PUSHTRU;
JUMP end_1;
false_1:
PUSHFLS;
end_1:
JUMPIFANDPOP true_2;
PUSHFLS;
JUMP end_2;
true_2:
PUSHTRU;
end_2:
POP 1;
EXIT;
@@ -0,0 +1,35 @@
@type [compiler]
@source
X or Y and Z or W;
@bytecode
PUSHVAR "X";
JUMPIFANDPOP true_0;
PUSHVAR "Y";
JUMPIFNOTANDPOP false_1;
PUSHVAR "Z";
JUMPIFNOTANDPOP false_1;
PUSHTRU;
JUMP end_1;
false_1:
PUSHFLS;
end_1:
JUMPIFANDPOP true_0;
PUSHFLS;
JUMP end_0;
true_0:
PUSHTRU;
end_0:
JUMPIFANDPOP true_2;
PUSHVAR "W";
JUMPIFANDPOP true_2;
PUSHFLS;
JUMP end_2;
true_2:
PUSHTRU;
end_2:
POP 1;
EXIT;
@@ -0,0 +1,14 @@
@type [compiler]
@source
({'name': 'Francesco'});
@bytecode
PUSHMAP 1;
PUSHSTR "name";
PUSHSTR "Francesco";
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,20 @@
@type [compiler]
@source
({'name': 'Francesco', 'age': 25});
@bytecode
PUSHMAP 2;
PUSHSTR "name";
PUSHSTR "Francesco";
INSERT;
PUSHSTR "age";
PUSHINT 25;
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,14 @@
@type [compiler]
@source
({name: 'Francesco'});
@bytecode
PUSHMAP 1;
PUSHSTR "name";
PUSHSTR "Francesco";
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,20 @@
@type [compiler]
@source
({name: 'Francesco', age: 25});
@bytecode
PUSHMAP 2;
PUSHSTR "name";
PUSHSTR "Francesco";
INSERT;
PUSHSTR "age";
PUSHINT 25;
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,15 @@
@type [compiler]
@source
({+name: 'Francesco'});
@bytecode
PUSHMAP 1;
PUSHVAR "name";
POS;
PUSHSTR "Francesco";
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,15 @@
@type [compiler]
@source
({+name: 'Francesco'});
@bytecode
PUSHMAP 1;
PUSHVAR "name";
POS;
PUSHSTR "Francesco";
INSERT;
POP 1;
EXIT;
@@ -0,0 +1,12 @@
@type [compiler]
@source
func();
@bytecode
PUSHVAR "func";
CALL 0, 1;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
func(none);
@bytecode
PUSHNNE;
PUSHVAR "func";
CALL 1, 1;
POP 1;
EXIT;
@@ -0,0 +1,14 @@
@type [compiler]
@source
func(true, false);
@bytecode
PUSHFLS;
PUSHTRU;
PUSHVAR "func";
CALL 2, 1;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
set[key];
@bytecode
PUSHVAR "set";
PUSHVAR "key";
SELECT;
POP 1;
EXIT;
@@ -0,0 +1,26 @@
@type [compiler]
@source
set["dog", "cow", "cat"];
@bytecode
PUSHVAR "set";
PUSHLST 3;
PUSHINT 0;
PUSHSTR "dog";
INSERT;
PUSHINT 1;
PUSHSTR "cow";
INSERT;
PUSHINT 2;
PUSHSTR "cat";
INSERT;
SELECT;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
set.key;
@bytecode
PUSHVAR "set";
PUSHSTR "key";
SELECT;
POP 1;
EXIT;
@@ -0,0 +1,12 @@
@type [compiler]
@source
-1;
@bytecode
PUSHINT 1;
NEG;
POP 1;
EXIT;
@@ -0,0 +1,12 @@
@type [compiler]
@source
+1;
@bytecode
PUSHINT 1;
POS;
POP 1;
EXIT;
@@ -0,0 +1,12 @@
@type [compiler]
@source
not 1;
@bytecode
PUSHINT 1;
NOT;
POP 1;
EXIT;
@@ -0,0 +1,9 @@
@type [compiler]
@source
1;
@bytecode
PUSHINT 1;
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
6.7;
@bytecode
PUSHFLT 6.7;
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
'Hello, world!';
@bytecode
PUSHSTR "Hello, world!";
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
true;
@bytecode
PUSHTRU;
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
false;
@bytecode
PUSHFLS;
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
none;
@bytecode
PUSHNNE;
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
({});
@bytecode
PUSHMAP 0;
POP 1;
EXIT;
@@ -0,0 +1,14 @@
@type [compiler]
@source
# This comment is because there
# can't be a '[' right before a
# tag.
[];
@bytecode
PUSHLST 0;
POP 1;
EXIT;
@@ -0,0 +1,9 @@
@type [compiler]
@source
{}
@bytecode
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
'This \\ is a slash!';
@bytecode
PUSHSTR "This \\ is a slash!";
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
'This \n is a newline!';
@bytecode
PUSHSTR "This \n is a newline!";
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
'This \t is an horizontal tab!';
@bytecode
PUSHSTR "This \t is an horizontal tab!";
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
'This \r is a special character!';
@bytecode
PUSHSTR "This \r is a special character!";
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
'Look at this \'!';
@bytecode
PUSHSTR "Look at this '!";
POP 1;
EXIT;
@@ -0,0 +1,11 @@
@type [compiler]
@source
"Look at this \"!";
@bytecode
PUSHSTR "Look at this \"!";
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 == 2;
@bytecode
PUSHINT 1;
PUSHINT 2;
EQL;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 != 2;
@bytecode
PUSHINT 1;
PUSHINT 2;
NQL;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 < 2;
@bytecode
PUSHINT 1;
PUSHINT 2;
LSS;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 > 2;
@bytecode
PUSHINT 1;
PUSHINT 2;
GRT;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 <= 2;
@bytecode
PUSHINT 1;
PUSHINT 2;
LEQ;
POP 1;
EXIT;
@@ -0,0 +1,13 @@
@type [compiler]
@source
1 >= 2;
@bytecode
PUSHINT 1;
PUSHINT 2;
GEQ;
POP 1;
EXIT;
@@ -0,0 +1,47 @@
@type [compiler]
@source
1 + 2 > 3 + 4;
1 + 2 < 3 + 4;
1 + 2 >= 3 + 4;
1 + 2 <= 3 + 4;
@bytecode
PUSHINT 1;
PUSHINT 2;
ADD;
PUSHINT 3;
PUSHINT 4;
ADD;
GRT;
POP 1;
PUSHINT 1;
PUSHINT 2;
ADD;
PUSHINT 3;
PUSHINT 4;
ADD;
LSS;
POP 1;
PUSHINT 1;
PUSHINT 2;
ADD;
PUSHINT 3;
PUSHINT 4;
ADD;
GEQ;
POP 1;
PUSHINT 1;
PUSHINT 2;
ADD;
PUSHINT 3;
PUSHINT 4;
ADD;
LEQ;
POP 1;
EXIT;