diff --git a/TODO b/TODO new file mode 100644 index 0000000..0b37b43 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +- talk about how functions are variables in the docs +- tests for MUL and DIV bytecodes \ No newline at end of file diff --git a/misc/bugs/bug.noja b/misc/bugs/bug.noja new file mode 100644 index 0000000..deccca2 --- /dev/null +++ b/misc/bugs/bug.noja @@ -0,0 +1 @@ +1 + 2 , 3 * 4 * 5; \ No newline at end of file diff --git a/src/lib/assembler/assemble.c b/src/lib/assembler/assemble.c index 1fd15ee..0a18625 100644 --- a/src/lib/assembler/assemble.c +++ b/src/lib/assembler/assemble.c @@ -189,7 +189,16 @@ static bool parseIntegerOperand(Context *ctx, Error *error, Operand *op) // pointing to a sequence of one or more digits // NOT followed by a dot and a digit after that // (so this is an integer for sure, not a float). - assert(ctx->cur < ctx->len && isdigit(ctx->str[ctx->cur])); + // Also, the sequence may be preceded by a '+' or + // '-'. + + int sign = 1; + if (ctx->str[ctx->cur] == '+') + ctx->cur++; + else if (ctx->str[ctx->cur] == '-') { + sign = -1; + ctx->cur++; + } long long int buffer = 0; do { @@ -209,9 +218,9 @@ static bool parseIntegerOperand(Context *ctx, Error *error, Operand *op) } while(ctx->cur < ctx->len && isdigit(ctx->str[ctx->cur])); // Not a float! - + op->type = OPTP_INT; - op->as_int = buffer; + op->as_int = sign * buffer; return true; } @@ -224,7 +233,16 @@ static bool parseFloatingOperand(Context *ctx, Error *error, Operand *op) // It's ensured by the caller that the cursor is // pointing to a sequence of one or more digits // followed by a dot and a digit after that. - assert(ctx->cur < ctx->len && isdigit(ctx->str[ctx->cur])); + // Also, the sequence may be preceded by a '+' or + // '-'. + + int sign = 1; + if (ctx->str[ctx->cur] == '+') + ctx->cur++; + else if (ctx->str[ctx->cur] == '-') { + sign = -1; + ctx->cur++; + } double buffer = 0; do { @@ -256,7 +274,7 @@ static bool parseFloatingOperand(Context *ctx, Error *error, Operand *op) } while(ctx->cur < ctx->len && isdigit(ctx->str[ctx->cur])); op->type = OPTP_FLOAT; - op->as_float = buffer; + op->as_float = sign * buffer; return true; } @@ -277,11 +295,21 @@ static bool parseOperands(Context *ctx, BPAlloc *alloc, Error *error, if(!parseStringOperand(ctx, error, alloc, &op)) return false; - } else if(isdigit(c)) { - + } else if(isdigit(c) || c == '-' || c == '+') { + /* Integer or float operand */ size_t k = ctx->cur; + + if (c == '-' || c == '+') { + k++; + if (k == ctx->len || !isdigit(ctx->str[k])) { + *ctx->error_offset = k; + Error_Report(error, ErrorType_SYNTAX, "Invalid character '%c' not followed by a digit", c); + return false; + } + } + while(k < ctx->len && isdigit(ctx->str[k])) k += 1; diff --git a/src/lib/compiler/parse.c b/src/lib/compiler/parse.c index b5b0267..274d006 100644 --- a/src/lib/compiler/parse.c +++ b/src/lib/compiler/parse.c @@ -1758,7 +1758,8 @@ static Node *parse_expression_2(Context *ctx, Node *left_expr, int min_prec, _Bo while(isbinop(ctx->token) && (precedenceof(ctx->token) > precedenceof(op) || (precedenceof(ctx->token) == precedenceof(op) && isrightassoc(ctx->token)))) { - right_expr = parse_expression_2(ctx, right_expr, precedenceof(op) + 1, allow_toplev_tuples, allow_assignments); + int new_prec = precedenceof(op) + (precedenceof(op) < precedenceof(ctx->token)); + right_expr = parse_expression_2(ctx, right_expr, new_prec, allow_toplev_tuples, allow_assignments); if(right_expr == NULL) return NULL; diff --git a/src/lib/run.c b/src/lib/run.c index 0a0f1de..396258b 100644 --- a/src/lib/run.c +++ b/src/lib/run.c @@ -884,7 +884,7 @@ static _Bool runInstruction(Runtime *runtime, Error *error) return Runtime_Push(runtime, error, obj); } - + case OPCODE_PUSHFLT: { ASSERT(opc == 1); diff --git a/src/test/field.c b/src/test/field.c index 488072a..8cf4596 100644 --- a/src/test/field.c +++ b/src/test/field.c @@ -114,10 +114,6 @@ ErrorID findField(NojaTestScanner *scanner) return ErrorID_VOID; } -// Returns: -// 0 if there are no more fields -// -1 on error -// 1 if a field was parsed ErrorID parseField(NojaTestScanner *scanner, NojaTestField *field) { ErrorID error; diff --git a/tests/compiler/func/Testcase_012_000.noja-test b/tests/compiler/func/Testcase_012_000.noja-test index dbf4179..8b19cf1 100644 --- a/tests/compiler/func/Testcase_012_000.noja-test +++ b/tests/compiler/func/Testcase_012_000.noja-test @@ -1,5 +1,5 @@ - @type [compiler] + @source fun nop(a = 1) diff --git a/tests/compiler/ifelse/Testcase_008_001.noja-test b/tests/compiler/ifelse/Testcase_008_001.noja-test index 342a587..b5adb34 100644 --- a/tests/compiler/ifelse/Testcase_008_001.noja-test +++ b/tests/compiler/ifelse/Testcase_008_001.noja-test @@ -1,5 +1,6 @@ @type [compiler] + @source if true: diff --git a/tests/runtime/add/float_plus_float.noja-test b/tests/runtime/add/float_plus_float.noja-test new file mode 100644 index 0000000..6fceb5a --- /dev/null +++ b/tests/runtime/add/float_plus_float.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.22; + PUSHFLT 700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790.61] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_float_2.noja-test b/tests/runtime/add/float_plus_float_2.noja-test new file mode 100644 index 0000000..f0fa6d6 --- /dev/null +++ b/tests/runtime/add/float_plus_float_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.22; + PUSHFLT 700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [610.17] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_float_3.noja-test b/tests/runtime/add/float_plus_float_3.noja-test new file mode 100644 index 0000000..51020a3 --- /dev/null +++ b/tests/runtime/add/float_plus_float_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.22; + PUSHFLT -700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-610.17] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_float_4.noja-test b/tests/runtime/add/float_plus_float_4.noja-test new file mode 100644 index 0000000..251ed82 --- /dev/null +++ b/tests/runtime/add/float_plus_float_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.22; + PUSHFLT -700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790.61] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_int.noja-test b/tests/runtime/add/float_plus_int.noja-test new file mode 100644 index 0000000..fe9d557 --- /dev/null +++ b/tests/runtime/add/float_plus_int.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.39; + PUSHINT 700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790.39] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_int_2.noja-test b/tests/runtime/add/float_plus_int_2.noja-test new file mode 100644 index 0000000..f2d5e17 --- /dev/null +++ b/tests/runtime/add/float_plus_int_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.39; + PUSHINT 700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [609.61] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_int_3.noja-test b/tests/runtime/add/float_plus_int_3.noja-test new file mode 100644 index 0000000..3a675fb --- /dev/null +++ b/tests/runtime/add/float_plus_int_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.39; + PUSHINT -700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-609.61] \ No newline at end of file diff --git a/tests/runtime/add/float_plus_int_4.noja-test b/tests/runtime/add/float_plus_int_4.noja-test new file mode 100644 index 0000000..cf6eaba --- /dev/null +++ b/tests/runtime/add/float_plus_int_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.39; + PUSHINT -700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790.39] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_float.noja-test b/tests/runtime/add/int_plus_float.noja-test new file mode 100644 index 0000000..44369aa --- /dev/null +++ b/tests/runtime/add/int_plus_float.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHFLT 700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790.39] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_float_2.noja-test b/tests/runtime/add/int_plus_float_2.noja-test new file mode 100644 index 0000000..52b831e --- /dev/null +++ b/tests/runtime/add/int_plus_float_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHFLT -700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-610.39] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_float_3.noja-test b/tests/runtime/add/int_plus_float_3.noja-test new file mode 100644 index 0000000..b427e30 --- /dev/null +++ b/tests/runtime/add/int_plus_float_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHFLT 700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [610.39] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_float_4.noja-test b/tests/runtime/add/int_plus_float_4.noja-test new file mode 100644 index 0000000..0971c62 --- /dev/null +++ b/tests/runtime/add/int_plus_float_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHFLT -700.39; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790.39] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_int.noja-test b/tests/runtime/add/int_plus_int.noja-test new file mode 100644 index 0000000..e5b6b80 --- /dev/null +++ b/tests/runtime/add/int_plus_int.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHINT 700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_int_2.noja-test b/tests/runtime/add/int_plus_int_2.noja-test new file mode 100644 index 0000000..3ca8838 --- /dev/null +++ b/tests/runtime/add/int_plus_int_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHINT 700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [610] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_int_3.noja-test b/tests/runtime/add/int_plus_int_3.noja-test new file mode 100644 index 0000000..52565a8 --- /dev/null +++ b/tests/runtime/add/int_plus_int_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHINT -700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-610] \ No newline at end of file diff --git a/tests/runtime/add/int_plus_int_4.noja-test b/tests/runtime/add/int_plus_int_4.noja-test new file mode 100644 index 0000000..143e354 --- /dev/null +++ b/tests/runtime/add/int_plus_int_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHINT -700; + ADD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790] \ No newline at end of file diff --git a/tests/runtime/mod/big_mod_small.noja-test b/tests/runtime/mod/big_mod_small.noja-test new file mode 100644 index 0000000..deacdba --- /dev/null +++ b/tests/runtime/mod/big_mod_small.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 100; + PUSHINT 8; + MOD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [4] \ No newline at end of file diff --git a/tests/runtime/mod/small_mod_big.noja-test b/tests/runtime/mod/small_mod_big.noja-test new file mode 100644 index 0000000..5328470 --- /dev/null +++ b/tests/runtime/mod/small_mod_big.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 8; + PUSHINT 100; + MOD; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [8] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_float.noja-test b/tests/runtime/sub/float_minus_float.noja-test new file mode 100644 index 0000000..e1ccaf8 --- /dev/null +++ b/tests/runtime/sub/float_minus_float.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.22; + PUSHFLT 700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-610.17] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_float_2.noja-test b/tests/runtime/sub/float_minus_float_2.noja-test new file mode 100644 index 0000000..cfbb25b --- /dev/null +++ b/tests/runtime/sub/float_minus_float_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.22; + PUSHFLT 700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790.61] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_float_3.noja-test b/tests/runtime/sub/float_minus_float_3.noja-test new file mode 100644 index 0000000..2e9672f --- /dev/null +++ b/tests/runtime/sub/float_minus_float_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.22; + PUSHFLT -700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790.61] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_float_4.noja-test b/tests/runtime/sub/float_minus_float_4.noja-test new file mode 100644 index 0000000..f240f02 --- /dev/null +++ b/tests/runtime/sub/float_minus_float_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.22; + PUSHFLT -700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [610.17] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_int.noja-test b/tests/runtime/sub/float_minus_int.noja-test new file mode 100644 index 0000000..7bab2cc --- /dev/null +++ b/tests/runtime/sub/float_minus_int.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.39; + PUSHINT 700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-609.61] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_int_2.noja-test b/tests/runtime/sub/float_minus_int_2.noja-test new file mode 100644 index 0000000..a3969c0 --- /dev/null +++ b/tests/runtime/sub/float_minus_int_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.39; + PUSHINT 700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790.39] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_int_3.noja-test b/tests/runtime/sub/float_minus_int_3.noja-test new file mode 100644 index 0000000..96a4859 --- /dev/null +++ b/tests/runtime/sub/float_minus_int_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT 90.39; + PUSHINT -700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790.39] \ No newline at end of file diff --git a/tests/runtime/sub/float_minus_int_4.noja-test b/tests/runtime/sub/float_minus_int_4.noja-test new file mode 100644 index 0000000..6c98d94 --- /dev/null +++ b/tests/runtime/sub/float_minus_int_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHFLT -90.39; + PUSHINT -700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [609.61] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_float.noja-test b/tests/runtime/sub/int_minus_float.noja-test new file mode 100644 index 0000000..bf1de3a --- /dev/null +++ b/tests/runtime/sub/int_minus_float.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHFLT 700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-610.39] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_float_2.noja-test b/tests/runtime/sub/int_minus_float_2.noja-test new file mode 100644 index 0000000..2af74e7 --- /dev/null +++ b/tests/runtime/sub/int_minus_float_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHFLT -700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790.39] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_float_3.noja-test b/tests/runtime/sub/int_minus_float_3.noja-test new file mode 100644 index 0000000..b0a1540 --- /dev/null +++ b/tests/runtime/sub/int_minus_float_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHFLT 700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790.39] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_float_4.noja-test b/tests/runtime/sub/int_minus_float_4.noja-test new file mode 100644 index 0000000..def0c28 --- /dev/null +++ b/tests/runtime/sub/int_minus_float_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHFLT -700.39; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [610.39] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_int.noja-test b/tests/runtime/sub/int_minus_int.noja-test new file mode 100644 index 0000000..d6d7cf6 --- /dev/null +++ b/tests/runtime/sub/int_minus_int.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHINT 700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-610] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_int_2.noja-test b/tests/runtime/sub/int_minus_int_2.noja-test new file mode 100644 index 0000000..a51801d --- /dev/null +++ b/tests/runtime/sub/int_minus_int_2.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHINT 700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-790] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_int_3.noja-test b/tests/runtime/sub/int_minus_int_3.noja-test new file mode 100644 index 0000000..79a013b --- /dev/null +++ b/tests/runtime/sub/int_minus_int_3.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT 90; + PUSHINT -700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [790] \ No newline at end of file diff --git a/tests/runtime/sub/int_minus_int_4.noja-test b/tests/runtime/sub/int_minus_int_4.noja-test new file mode 100644 index 0000000..aec8f66 --- /dev/null +++ b/tests/runtime/sub/int_minus_int_4.noja-test @@ -0,0 +1,14 @@ +@type [runtime] + +@bytecode + + PUSHINT -90; + PUSHINT -700; + SUB; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [610] \ No newline at end of file diff --git a/tests/runtime/tcase_013.noja-test b/tests/runtime/tcase_013.noja-test new file mode 100644 index 0000000..8d8ecf5 --- /dev/null +++ b/tests/runtime/tcase_013.noja-test @@ -0,0 +1,13 @@ +@type [runtime] + +@bytecode + + PUSHINT 23; + NEG; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-23] \ No newline at end of file diff --git a/tests/runtime/tcase_014.noja-test b/tests/runtime/tcase_014.noja-test new file mode 100644 index 0000000..b6f90ca --- /dev/null +++ b/tests/runtime/tcase_014.noja-test @@ -0,0 +1,13 @@ +@type [runtime] + +@bytecode + + PUSHINT -23; + NEG; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [23] \ No newline at end of file diff --git a/tests/runtime/tcase_015.noja-test b/tests/runtime/tcase_015.noja-test new file mode 100644 index 0000000..cdcc831 --- /dev/null +++ b/tests/runtime/tcase_015.noja-test @@ -0,0 +1,13 @@ +@type [runtime] + +@bytecode + + PUSHFLT 2.3; + NEG; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [-2.30] \ No newline at end of file diff --git a/tests/runtime/tcase_016.noja-test b/tests/runtime/tcase_016.noja-test new file mode 100644 index 0000000..88a6269 --- /dev/null +++ b/tests/runtime/tcase_016.noja-test @@ -0,0 +1,13 @@ +@type [runtime] + +@bytecode + + PUSHFLT -2.3; + NEG; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [2.30] \ No newline at end of file diff --git a/tests/runtime/tcase_017.noja-test b/tests/runtime/tcase_017.noja-test new file mode 100644 index 0000000..c792e9f --- /dev/null +++ b/tests/runtime/tcase_017.noja-test @@ -0,0 +1,13 @@ +@type [runtime] + +@bytecode + + PUSHTRU; + NOT; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [false] \ No newline at end of file diff --git a/tests/runtime/tcase_018.noja-test b/tests/runtime/tcase_018.noja-test new file mode 100644 index 0000000..2c4027d --- /dev/null +++ b/tests/runtime/tcase_018.noja-test @@ -0,0 +1,13 @@ +@type [runtime] + +@bytecode + + PUSHFLS; + NOT; + + PUSHVAR "print"; + CALL 1, 1; + POP 1; + EXIT; + +@output [true] \ No newline at end of file