diff options
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_complex_negate.txt')
-rw-r--r-- | js/scripting-lang/scratch_tests/test_complex_negate.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_complex_negate.txt b/js/scripting-lang/scratch_tests/test_complex_negate.txt new file mode 100644 index 0000000..60f858f --- /dev/null +++ b/js/scripting-lang/scratch_tests/test_complex_negate.txt @@ -0,0 +1,28 @@ +/* Test complex unary minus scenarios */ +x : 5; +y : 3; + +/* Test nested unary minus */ +z1 : -(-5); /* negate(negate(5)) = 5 */ +z2 : -(-x); /* negate(negate(x)) = 5 */ + +/* Test unary minus with expressions */ +z3 : -(x + y); /* negate(add(x, y)) = -8 */ +z4 : -x + y; /* add(negate(x), y) = -2 */ + +/* Test unary minus with function calls */ +f : x -> x * 2; +z5 : -f x; /* negate(apply(f, x)) = -10 */ + +/* Test edge cases */ +z6 : -0; /* negate(0) = 0 */ +z7 : -(-0); /* negate(negate(0)) = 0 */ + +/* Output results */ +..out z1; +..out z2; +..out z3; +..out z4; +..out z5; +..out z6; +..out z7; \ No newline at end of file |