diff --git a/tests/plat/b/incdec_b.b b/tests/plat/b/incdec_b.b new file mode 100644 index 000000000..b3cb16da5 --- /dev/null +++ b/tests/plat/b/incdec_b.b @@ -0,0 +1,77 @@ +# +i 0; + +ext_t() +{ + extrn i; + + i = 0; + if (!(i++ == 0)) fail(__LINE__); + + i == 1; + if (!(i-- == 1)) fail(__LINE__); + if (!(i == 0)) fail(__LINE__); + + i = 0; + if (!(++i == 1)) fail(__LINE__); + if (!(i == 1)) fail(__LINE__); + + i == 1; + if (!(--i == 0)) fail(__LINE__); + if (!(i == 0)) fail(__LINE__); +} + +int_t() +{ + auto i; + + i = 0; + if (!(i++ == 0)) fail(__LINE__); + + i == 1; + if (!(i-- == 1)) fail(__LINE__); + if (!(i == 0)) fail(__LINE__); + + i = 0; + if (!(++i == 1)) fail(__LINE__); + if (!(i == 1)) fail(__LINE__); + + i == 1; + if (!(--i == 0)) fail(__LINE__); + if (!(i == 0)) fail(__LINE__); +} + +star_t() +{ + extrn i; + auto p; + + p = &i; + + i = 0; + if (!((*p)++ == 0)) fail(__LINE__); + + i == 1; + if (!((*p)-- == 1)) fail(__LINE__); + if (!(i == 0)) fail(__LINE__); + + i = 0; + if (!(++(*p) == 1)) fail(__LINE__); + if (!(i == 1)) fail(__LINE__); + + i == 1; + if (!(--(*p) == 0)) fail(__LINE__); + if (!(i == 0)) fail(__LINE__); +} + +main() +{ + ext_t(); + int_t(); + star_t(); + + finished(); + return(0); +} + + diff --git a/tests/plat/b/operators_b.b b/tests/plat/b/operators_b.b index 36b4b742a..5baa674b1 100644 --- a/tests/plat/b/operators_b.b +++ b/tests/plat/b/operators_b.b @@ -9,18 +9,14 @@ main() extrn minusone, zero, one, two; auto i, j; + if (!(zero == 0)) fail(__LINE__); + if (!(one == 1)) fail(__LINE__); if (!(-one == -1)) fail(__LINE__); if (!(!one == 0)) fail(__LINE__); if (!(!zero == 1)) fail(__LINE__); if (!(~zero == -1)) fail(__LINE__); if (!(~minusone == 0)) fail(__LINE__); - if (!((two + two) == 4)) fail(__LINE__); - if (!((two - two) == 0)) fail(__LINE__); - if (!((two * two) == 4)) fail(__LINE__); - if (!((two / two) == 1)) fail(__LINE__); - if (!((two % two) == 0)) fail(__LINE__); - if (!(zero == zero)) fail(__LINE__); if (!(zero != one)) fail(__LINE__); if (!(zero < one)) fail(__LINE__); @@ -30,6 +26,12 @@ main() if (!(one >= zero)) fail(__LINE__); if (!(one >= one)) fail(__LINE__); + if (!((two + two) == 4)) fail(__LINE__); + if (!((two - two) == 0)) fail(__LINE__); + if (!((two * two) == 4)) fail(__LINE__); + if (!((two / two) == 1)) fail(__LINE__); + if (!((two % two) == 0)) fail(__LINE__); + if (!((one << 1) == 2)) fail(__LINE__); if (!((two >> 1) == 1)) fail(__LINE__); @@ -62,23 +64,6 @@ main() if (!(one ? 1 : 0)) fail(__LINE__); if (!(zero ? 0 : 1)) fail(__LINE__); - i = 0; - if (!(i++ == 0)) fail(__LINE__); - if (!(i == 1)) fail(__LINE__); - - i == 1; - if (!(i-- == 1)) fail(__LINE__); - if (!(i == 0)) fail(__LINE__); - - i = 0; - if (!(++i == 1)) fail(__LINE__); - if (!(i == 1)) fail(__LINE__); - - i == 1; - if (!(--i == 0)) fail(__LINE__); - if (!(i == 0)) fail(__LINE__); - finished(); return(0); } -