From 0152f9a997ac21e92e97d07200a46bf159d8f50f Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 14 Jan 2019 18:56:32 -0500 Subject: [PATCH] migrating to googletest --- unit_tests/tests/test_logic_expression.cpp | 6 +++--- unit_tests/tests/test_trigger_decoder.cpp | 4 ++-- unit_tests/tests/test_util.cpp | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/unit_tests/tests/test_logic_expression.cpp b/unit_tests/tests/test_logic_expression.cpp index 72be2800fc..1e037ca87e 100644 --- a/unit_tests/tests/test_logic_expression.cpp +++ b/unit_tests/tests/test_logic_expression.cpp @@ -92,7 +92,7 @@ static void testExpression2(float selfValue, const char *line, float expected) { LEElementPool pool(thepool, TEST_POOL_SIZE); LEElement * element = pool.parseExpression(line); print("Parsing [%s]", line); - assertTrueM("Not NULL expected", element != NULL); + ASSERT_TRUE(element != NULL) << "Not NULL expected"; LECalculator c; EngineTestHelper eth(FORD_INLINE_6_1995); @@ -163,7 +163,7 @@ TEST(misc, testLogicExpressions) { pool.reset(); LEElement *element; element = pool.parseExpression("fan no_such_method"); - assertTrueM("NULL expected", element == NULL); + ASSERT_TRUE(element == NULL) << "NULL expected"; /** @@ -191,7 +191,7 @@ TEST(misc, testLogicExpressions) { LEElement thepool[TEST_POOL_SIZE]; LEElementPool pool(thepool, TEST_POOL_SIZE); LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR"); - assertTrueM("Not NULL expected", element != NULL); + ASSERT_TRUE(element != NULL) << "Not NULL expected"; LECalculator c; ASSERT_EQ( 1, c.getValue2(0, element PASS_ENGINE_PARAMETER_SUFFIX)) << "that expression"; diff --git a/unit_tests/tests/test_trigger_decoder.cpp b/unit_tests/tests/test_trigger_decoder.cpp index a229fc54b9..688228e0b3 100644 --- a/unit_tests/tests/test_trigger_decoder.cpp +++ b/unit_tests/tests/test_trigger_decoder.cpp @@ -785,7 +785,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) { // { // scheduling_s *ev = engine->executor.getForUnitTest(9); // ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#2"; -// assertTrueM("down 50", ev == &engineConfiguration->fuelActuators[2].signalPair[1].signalTimerDown); +// ASSERT_TRUE(ev == &engineConfiguration->fuelActuators[2].signalPair[1].signalTimerDown) << "down 50"; // } @@ -1073,7 +1073,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) { engine->executor.executeAll(timeNowUs + MS2US(17.5) + 1); // injector does not go low too soon, that's a feature :) - assertTrueM("injector@2", enginePins.injectors[0].currentLogicValue); + ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2"; eth.fireFall(20); diff --git a/unit_tests/tests/test_util.cpp b/unit_tests/tests/test_util.cpp index 1e5c71238b..11855a77e7 100644 --- a/unit_tests/tests/test_util.cpp +++ b/unit_tests/tests/test_util.cpp @@ -327,7 +327,7 @@ TEST(misc, testConsoleLogic) { ASSERT_TRUE(strEqual("echo", unquote(buffer))); strcpy(buffer, "\"echo\""); - assertTrueM("unquote quoted", strEqual("echo", unquote(buffer))); + ASSERT_TRUE(strEqual("echo", unquote(buffer))) << "unquote quoted"; char *ptr = validateSecureLine(UNKNOWN_COMMAND); ASSERT_EQ(0, strcmp(UNKNOWN_COMMAND, ptr)); @@ -421,11 +421,11 @@ TEST(misc, testMisc) { } { float v = atoff("nan"); - assertTrueM("NaN atoff", cisnan(v)); + ASSERT_TRUE(cisnan(v)) << "NaN atoff"; } { float v = atoff("N"); - assertTrueM("NaN atoff", cisnan(v)); + ASSERT_TRUE(cisnan(v)) << "NaN atoff"; } // ASSERT_EQ(true, strEqual("spa3", getPinName(SPARKOUT_3_OUTPUT))); @@ -473,15 +473,15 @@ TEST(misc, testMenuTree) { ASSERT_TRUE(tree.current == &miTopLevel4); tree.enterSubMenu(); - assertTrueM("still same", tree.current == &miTopLevel4); // no children in this one + ASSERT_TRUE(tree.current == &miTopLevel4) << "still same"; // no children in this one tree.nextItem(); ASSERT_TRUE(tree.topVisible == &miTopLevel3); - assertTrueM("tl5", tree.current == &miTopLevel5); + ASSERT_TRUE(tree.current == &miTopLevel5) << "tl5"; tree.nextItem(); - assertTrueM("tl1 t", tree.topVisible == &miTopLevel1); - assertTrueM("tl1 c", tree.current == &miTopLevel1); + ASSERT_TRUE(tree.topVisible == &miTopLevel1) << "tl1 t"; + ASSERT_TRUE(tree.current == &miTopLevel1) << "tl1 c"; tree.nextItem(); tree.nextItem();