diff --git a/java_console/models/src/com/rusefi/test/ParserTest.java b/java_console/models/src/com/rusefi/test/ParserTest.java index cdae964033..337c809a16 100644 --- a/java_console/models/src/com/rusefi/test/ParserTest.java +++ b/java_console/models/src/com/rusefi/test/ParserTest.java @@ -20,9 +20,9 @@ public class ParserTest { assertParse("rpm 0 >", "rpm > false"); assertParse("rpm 0 >", "(rpm > false)"); - assertParse("rpm user0 > clt user2 > or", "(rpm > user0) or (clt > user2)"); - assertParse("1 2 | 3 |", "1 | 2 | 3"); - assertParse("rpm user0 > clt user2 > or vbatt user1 > or", "(rpm > user0) or (clt > user2) or (vbatt > user1)"); + assertParseB("rpm user0 > clt user2 > or", "(rpm > user0) or (clt > user2)"); + assertParseB("1 2 | 3 |", "1 | 2 | 3"); + assertParseB("rpm user0 > clt user2 > or vbatt user1 > or", "(rpm > user0) or (clt > user2) or (vbatt > user1)"); } private void assertParseB(String rpn, String expression) { @@ -30,7 +30,7 @@ public class ParserTest { String h = getInfix(rpn); System.out.println(h); - assertEquals(getReplace(expression), getReplace(h)); + assertEquals(getReplace(expression).toLowerCase(), getReplace(h).toLowerCase()); } private String getReplace(String h) { @@ -102,31 +102,29 @@ public class ParserTest { @Test public void testRusEfi() { - assertParse("1 4 or", "1 or 4"); - assertParse("1 4 or", "1 OR 4"); + assertParseB("1 4 or", "1 or 4"); + assertParseB("1 4 or", "1 OR 4"); assertParseB("time_since_boot 4 <", "(time_since_boot < 4)"); assertParseB("1 4 |", "1 | 4"); - assertParse("time_since_boot 4 < rpm 0 > |", "(time_since_boot < 4) | (rpm > 0)"); + assertParseB("time_since_boot 4 < rpm 0 > |", "(time_since_boot < 4) | (rpm > 0)"); - assertParse("1 4 and", "1 and 4"); - assertParse("1 4 and", "1 AND 4"); + assertParseB("1 4 and", "1 and 4"); + assertParseB("1 4 and", "1 AND 4"); assertParseB("1 4 &", "1 & 4"); - assertParse("coolant fan_off_setting >", "(coolant > fan_off_setting)"); + assertParseB("coolant fan_off_setting >", "(coolant > fan_off_setting)"); - assertParse("1 coolant fan_on_setting > or", "1 OR (coolant > fan_on_setting)"); - assertParse("fan coolant fan_off_setting > and coolant fan_on_setting > or", "(fan and (coolant > fan_off_setting)) OR (coolant > fan_on_setting)"); + assertParseB("1 coolant fan_on_setting > or", "1 OR (coolant > fan_on_setting)"); + assertParseB("fan coolant fan_off_setting > and coolant fan_on_setting > or", "(fan and (coolant > fan_off_setting)) OR (coolant > fan_on_setting)"); - assertParse("time_since_boot 4 <= rpm 0 > |", "(time_since_boot <= 4) | (rpm > 0)"); + assertParseB("time_since_boot 4 <= rpm 0 > |", "(time_since_boot <= 4) | (rpm > 0)"); - assertParse("time_since_boot 4 <= rpm 0 > |", "(time_since_boot <= 4) | (rpm > 0)"); - - assertParse("time_since_boot 4 <= rpm 0 > or", "(time_since_boot <= 4) OR (rpm > 0)"); - - assertParse("self rpm 4800 >= and rpm 5000 > or", "(self and (rpm >= 4800)) OR (rpm > 5000)"); + assertParseB("time_since_boot 4 <= rpm 0 > |", "(time_since_boot <= 4) | (rpm > 0)"); + assertParseB("time_since_boot 4 <= rpm 0 > or", "(time_since_boot <= 4) OR (rpm > 0)"); + assertParseB("self rpm 4800 >= and rpm 5000 > or", "(self and (rpm >= 4800)) OR (rpm > 5000)"); } } \ No newline at end of file