Suppose we have 3 variables, and we need to STATE that they can either all be -1, or none of them can be -1. I wrote the following code:
x := 1;
y := 1;
z := 1;
ASSERT( (x = -1) = (y = -1) = (z = -1) );
I often write such a check, but for two variables. Surprisingly, the triple comparison is also made, but it does not work properly. For values (1, 1, 1), I expect it to be true. After substitution of variable values and simplification, we obtain:
ASSERT( False = False = False );
and I thought that he should evaluate True, but it is not. So how is this triple comparison evaluated?
source
share