auto-sync

This commit is contained in:
rusEfi 2016-01-27 18:01:42 -05:00
parent d0b482c76d
commit 899d15a3a6
1 changed files with 12 additions and 10 deletions

View File

@ -32,10 +32,8 @@ import static org.junit.Assert.assertEquals;
* Test class.
* User: Dmytro
* Date: 23.01.13
* Time: 12:52
*/
public class BracerParserTest {
private final String INPUT_NOVAR = "-sin(3+4+cos(6)/exp(10/pow(22,-1)))";
private BracerParser bracerParser;
@Before
@ -43,13 +41,6 @@ public class BracerParserTest {
bracerParser = new BracerParser();
}
@Test
@Ignore
public void testEvaluateNoVar() throws Exception {
bracerParser.parse(INPUT_NOVAR);
assertEquals("-0.6570194619480038", bracerParser.evaluate());
}
@Test
public void testSimpleBoolean() throws Exception {
bracerParser.parse("true or false");
@ -63,7 +54,10 @@ public class BracerParserTest {
bracerParser.parse("(true > false)");
assertEquals("1", bracerParser.evaluate());
assertEquals("1 0 >", bracerParser.getRusEfi());
}
@Test
public void testBooleanConversion() throws ParseException {
bracerParser.parse("rpm > false");
assertEquals("rpm 0 >", bracerParser.getRusEfi());
@ -84,6 +78,7 @@ public class BracerParserTest {
@Test
@Ignore
public void testBooleanNot1() throws Exception {
// todo: why EmptyStackException? is the issue with the test or with us?
bracerParser.parse("not( ( true and ( false or ( true and ( not( true ) or ( false ) ) ) ) ) and ( ( false ) ) )");
assertEquals("1", bracerParser.evaluate());
}
@ -108,9 +103,16 @@ public class BracerParserTest {
@Test
public void testBooleanNot2() throws Exception {
bracerParser.parse("1 & not(false)");
assertEquals("0", bracerParser.evaluate());// todo: this does not seem right
assertEquals("1 not 0 &", bracerParser.getRusEfi()); // todo: this does not seem right
// bracerParser.parse("not(false)"); // todo: this is broken
// assertEquals("1", bracerParser.evaluate());
// assertEquals("1 0 | not 0 & 1 0 | |", bracerParser.getRusEfi());
bracerParser.parse("(((true | false) & not(false)) | (true | false))");
assertEquals("1", bracerParser.evaluate());
assertEquals("1 0 | not 0 & 1 0 | |", bracerParser.getRusEfi());
}
}