runtime tests for relational operators

This commit is contained in:
Francesco Cozzuto
2023-01-23 13:17:34 +01:00
parent f7a2cb0611
commit d786d7d1fd
89 changed files with 1207 additions and 5 deletions
+3 -1
View File
@@ -458,8 +458,10 @@ Executable *assemble(Source *src, Error *error, int *error_offset)
assert(ctx.cur == ctx.len || ctx.str[ctx.cur] == ';'); assert(ctx.cur == ctx.len || ctx.str[ctx.cur] == ';');
if(ctx.cur < ctx.len) ctx.cur += 1; if(ctx.cur < ctx.len) ctx.cur += 1;
if(!ExeBuilder_Append(builder, error, opcode, opv, opc, opcode_name.offset, opcode_name.length)) if(!ExeBuilder_Append(builder, error, opcode, opv, opc, opcode_name.offset, opcode_name.length)) {
*error_offset = ctx.cur;
goto done; goto done;
}
} }
size_t unresolved_count = LabelList_GetUnresolvedCount(list); size_t unresolved_count = LabelList_GetUnresolvedCount(list);
+8 -2
View File
@@ -1137,7 +1137,10 @@ int runSource(Runtime *runtime, Source *source, Object *rets[static MAX_RETS], E
int error_offset; int error_offset;
Executable *exe = compile(source, error, &error_offset); Executable *exe = compile(source, error, &error_offset);
if(exe == NULL) { if(exe == NULL) {
Runtime_PushFailedFrame(runtime, error, source, error_offset); // If this fails, there's nothing we can do Error suberror;
Error_Init(&suberror);
Runtime_PushFailedFrame(runtime, &suberror, source, error_offset); // If this fails, there's nothing we can do
Error_Free(&suberror);
return -1; return -1;
} }
@@ -1152,7 +1155,10 @@ int runBytecodeSource(Runtime *runtime, Source *source, Object *rets[static MAX_
int error_offset; int error_offset;
Executable *exe = assemble(source, error, &error_offset); Executable *exe = assemble(source, error, &error_offset);
if(exe == NULL) { if(exe == NULL) {
Runtime_PushFailedFrame(runtime, error, source, error_offset); // If this fails, there's nothing we can do Error suberror;
Error_Init(&suberror);
Runtime_PushFailedFrame(runtime, &suberror, source, error_offset); // If this fails, there's nothing we can do
Error_Free(&suberror);
return -1; return -1;
} }
+1 -1
View File
@@ -620,7 +620,7 @@ bool Runtime_PushFailedFrame(Runtime *runtime, Error *error, Source *source, int
failed_frame->base.type = FrameType_FAILED; failed_frame->base.type = FrameType_FAILED;
failed_frame->base.prev = NULL; failed_frame->base.prev = NULL;
failed_frame->source = source; failed_frame->source = source_copy;
failed_frame->offset = offset; failed_frame->offset = offset;
if (!appendFrame(runtime, error, (Frame*) failed_frame)) { if (!appendFrame(runtime, error, (Frame*) failed_frame)) {
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 8.4;
EQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 7.2;
EQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
+13
View File
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 8.4;
EQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 8;
EQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 7;
EQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHFLT 7.1;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHFLT 7.1;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHFLT 7.1;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 7.1;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.3;
PUSHFLT 7.1;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.8;
PUSHINT 7;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHINT 7;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHINT 7;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHINT 7;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHINT 7;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.8;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.9;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.0;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.1;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.2;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 1;
PUSHINT 2;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 6;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 7;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 8;
GEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHFLT 7.1;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHFLT 7.1;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHFLT 7.1;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 7.1;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.3;
PUSHFLT 7.1;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.8;
PUSHINT 7;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHINT 7;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHINT 7;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHINT 7;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHINT 7;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.8;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.9;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.0;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.1;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.2;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 1;
PUSHINT 2;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 6;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 7;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 8;
GRT;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHFLT 7.1;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHFLT 7.1;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHFLT 7.1;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 7.1;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.3;
PUSHFLT 7.1;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.8;
PUSHINT 7;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHINT 7;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHINT 7;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHINT 7;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHINT 7;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.8;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.9;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.0;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.1;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.2;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 1;
PUSHINT 2;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 6;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 7;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 8;
LEQ;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHFLT 7.1;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHFLT 7.1;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHFLT 7.1;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 7.1;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.3;
PUSHFLT 7.1;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.8;
PUSHINT 7;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 6.9;
PUSHINT 7;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.0;
PUSHINT 7;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.1;
PUSHINT 7;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHINT 7;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.8;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 6.9;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.0;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.1;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 7.2;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 1;
PUSHINT 2;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 6;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 7;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,14 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 8;
LSS;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 7.2;
NQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHFLT 7.2;
PUSHFLT 8.4;
NQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
+13
View File
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHFLT 8.4;
NQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 7;
NQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [false]
@@ -0,0 +1,13 @@
@type [runtime]
@bytecode
PUSHINT 7;
PUSHINT 8;
NQL;
PUSHVAR "print";
CALL 1, 1;
POP 1;
EXIT;
@output [true]