Re: [SCXML] Incorrect and invalid ecmascript condition in IR test 459
Ate Douma <[email protected]> Tue, 29 Dec 2015 01:47:46 +0100
| Newsgroups | gmane.comp.web.voice |
|---|---|
| Message-ID | <[email protected]> |
On 2015-12-28 21:06, David Junger wrote: > Le 28 d=C3=A9c. 2015 =C3=A0 17:18, Ate Douma <[email protected]> a =C3=A9cri= t : >> >> I've just noticed an error in Implementation Report test 459 (ecmascri= pt). >> >> This test contains the incorrect (and invalid!) ecmascript condition: >> >> "Var4=3D=3D0 | Var3 !=3D 2". > > It=E2=80=99s not technically invalid, and it=E2=80=99s not functionally= broken either, > although probably by accident. > > =E2=80=98|=E2=80=99 is a bitwise OR, has lower priority than comparison= operators, and, when > its operands are booleans (which they are here), it coerces them to 0 o= r 1 > and so the result is 0 or 1, which is coerced back to the expected bool= ean. > > David > Agreed, I probably shouldn't have said "invalid" :). And indeed its not that this test always will succeed, but at least it (a= lways) fails to validate that Var1 and/or Var5 shouldn't be 0 at the end. What I wanted to say is that there are two different type of errors with = the current expression: "Var4=3D=3D0" should be "Var5=3D=3D0" (error) and bitwise OR "|" should be logical OR "||" (invalid) I suspect this test has been modified heavily in the past as the comments= (including the description) don't add up to the applied logic either, referring to either Var4 or var1 to be tested while I now think it is Var= 5 which=20 is intended to be tested (being not 0). Anyhow, I think the current expression really is incorrect and also more confusing as a negative test. It would be much easier and strict when defined like: <transition cond=3D"Var5 =3D=3D 1 && Var3 =3D=3D 2" target=3D"= pass"/> <transition target=3D"fail"/> Ate