rusefi/unit_tests/test_logic_expression.cpp

44 lines
918 B
C++

/**
* @file test_logic_expression.cpp
*
* https://sourceforge.net/p/rusefi/tickets/102/
*
* @date Oct 3, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "main.h"
#include "test_logic_expression.h"
#include "logic_expression.h"
void testLogicExpressions(void) {
printf("*************************************************** testLogicExpressions\r\n");
LECalculator c;
LEElement value1;
value1.init(LE_NUMERIC_VALUE, 123.0);
c.add(&value1);
assertEqualsM("123", 123.0, c.getValue());
LEElement value2;
value2.init(LE_NUMERIC_VALUE, 321.0);
c.add(&value2);
LEElement value3;
value3.init(LE_OPERATOR_AND);
c.add(&value3);
/**
* fuel_pump = (time_since_boot < 4 seconds) OR (rpm > 0)
* fuel_pump = time_since_boot 4 less rpm 0 more OR
*/
/**
* fan = (not fan && coolant > 90) OR (fan && coolant > 85)
* fan = fan NOT coolant 90 AND more fan coolant 85 more AND OR
*/
}