Fixed right-to-left interpreter and repeated unary operators

This commit is contained in:
cschreib
2017-07-01 18:36:19 +02:00
parent 4cdeb9150e
commit 9de3ed238a
2 changed files with 67 additions and 27 deletions

22
test.c
View File

@@ -684,6 +684,17 @@ void test_logic() {
{"0 || 0", 0},
{"!0", 1},
{"!1", 0},
{"!2", 0},
{"!-2", 0},
{"-!2", 0},
{"!!0", 0},
{"!!1", 1},
{"!!2", 1},
{"!!-2", 1},
{"!-!2", 1},
{"-!!2", -1},
{"--!!2", 1},
{"1 < 2", 1},
{"2 < 2", 0},
@@ -724,6 +735,17 @@ void test_logic() {
{"5+!(5 < 4)+10", 16},
{"5+!(5 < 4+10)", 5},
{"!(5+5 < 4)+10", 11},
#ifdef TE_POW_FROM_RIGHT
{"!0^2", 1},
{"!0^-1", 0},
{"-!0^2", -1},
#else
{"!0^2", 1},
{"!0^-1", 1},
{"-!0^2", 1},
#endif
};