From fa61f63ef49a22edcb21235feef5d3a4f2dd59c5 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 14 Jan 2019 18:22:31 -0500 Subject: [PATCH] migrating to googletest --- unit_tests/tests/test_fuel_map.cpp | 2 +- unit_tests/tests/test_sensors.cpp | 2 +- unit_tests/tests/test_util.cpp | 2 +- unit_tests/unit_test_framework.cpp | 4 ---- unit_tests/unit_test_framework.h | 1 - 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/unit_tests/tests/test_fuel_map.cpp b/unit_tests/tests/test_fuel_map.cpp index ac6f4150a4..fa4f0c311d 100644 --- a/unit_tests/tests/test_fuel_map.cpp +++ b/unit_tests/tests/test_fuel_map.cpp @@ -155,7 +155,7 @@ static void confgiureFordAspireTriggerShape(TriggerShape * s) { assertEqualsM("expecting 0", 0, s->wave.findAngleMatch(53.747 / 720.0, s->getSize())); assertEqualsM("expecting not found", -1, s->wave.findAngleMatch(53 / 720.0, s->getSize())); - assertEquals(7, s->wave.findAngleMatch(588.045 / 720.0, s->getSize())); + ASSERT_EQ(7, s->wave.findAngleMatch(588.045 / 720.0, s->getSize())); assertEqualsM("expecting 0", 0, s->wave.findInsertionAngle(23.747 / 720.0, s->getSize())); assertEqualsM("expecting 1", 1, s->wave.findInsertionAngle(63.747 / 720.0, s->getSize())); diff --git a/unit_tests/tests/test_sensors.cpp b/unit_tests/tests/test_sensors.cpp index 07536817ad..d6abcfe134 100644 --- a/unit_tests/tests/test_sensors.cpp +++ b/unit_tests/tests/test_sensors.cpp @@ -36,7 +36,7 @@ TEST(sensors, tps) { engineConfiguration->tpsMax = 193; engineConfiguration->tpsMin = 43; - assertEquals(49.3333, getTpsValue(4 * 117 PASS_ENGINE_PARAMETER_SUFFIX)); + ASSERT_NEAR(49.3333, getTpsValue(4 * 117 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D); engineConfiguration->tpsMax = 43; diff --git a/unit_tests/tests/test_util.cpp b/unit_tests/tests/test_util.cpp index eddbd70aaf..4421772080 100644 --- a/unit_tests/tests/test_util.cpp +++ b/unit_tests/tests/test_util.cpp @@ -29,7 +29,7 @@ TEST(util, crc) { ASSERT_EQ(4, efiRound(4.4, 1)); - assertEquals(1.2, efiRound(1.2345, 0.1)); + ASSERT_FLOAT_EQ(1.2, efiRound(1.2345, 0.1)); print("*************************************** testCrc\r\n"); diff --git a/unit_tests/unit_test_framework.cpp b/unit_tests/unit_test_framework.cpp index eebdb0ea3f..4e99abd9d4 100644 --- a/unit_tests/unit_test_framework.cpp +++ b/unit_tests/unit_test_framework.cpp @@ -45,10 +45,6 @@ void assertEqualsM(const char *msg, float expected, float actual) { assertEqualsM2(msg, expected, actual, 0.0001); } -void assertEquals(float expected, float actual) { - assertEqualsM("", expected, actual); -} - void assertTrueM(const char *msg, float actual) { assertEqualsM(msg, TRUE, actual); } diff --git a/unit_tests/unit_test_framework.h b/unit_tests/unit_test_framework.h index da9f3d696e..96803d126c 100644 --- a/unit_tests/unit_test_framework.h +++ b/unit_tests/unit_test_framework.h @@ -23,7 +23,6 @@ void assertEqualsM(const char *msg, float expected, float actual); void assertEqualsLM(const char *msg, long expected, long actual); void assertEqualsM4(const char *prefix, const char *msg, float expected, float actual); void assertEqualsM5(const char *prefix, const char *message, float expected, float actual, float EPS); -void assertEquals(float expected, float actual); void assertTrueM(const char *msg, float actual); void assertFalseM(const char *msg, float actual);