From 955b2b5c3f87d056c70dbde8feaf62f9a9570331 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 2 Dec 2019 13:53:31 -0500 Subject: [PATCH] misc clean-up --- unit_tests/tests/test_gpiochip.cpp | 21 ++++++++++--------- .../tests/test_on_demand_parameters.cpp | 5 +++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/unit_tests/tests/test_gpiochip.cpp b/unit_tests/tests/test_gpiochip.cpp index 98172d2909..eaa00411fc 100644 --- a/unit_tests/tests/test_gpiochip.cpp +++ b/unit_tests/tests/test_gpiochip.cpp @@ -42,6 +42,7 @@ static int calls_to_failed_chip = 0; static int testchip_failed_writePad(void *data, brain_pin_e pin, int value) { calls_to_failed_chip++; + return 0; } static int testchip_failed_init(void *data) @@ -123,24 +124,24 @@ TEST(gpioext, testGpioExt) { EXPECT_EQ(2, initcalls); /* gpio reads */ - EXPECT_TRUE(gpiochips_readPad(chip1_base + 0) == 0); - EXPECT_TRUE(gpiochips_readPad(chip1_base + 1) != 0); + EXPECT_TRUE(gpiochips_readPad((brain_pin_e)(chip1_base + 0)) == 0); + EXPECT_TRUE(gpiochips_readPad((brain_pin_e)(chip1_base + 1)) != 0); /* gpio write */ - gpiochips_writePad(chip2_base + 0, 0); - gpiochips_writePad(chip2_base + 1, 1); + gpiochips_writePad((brain_pin_e)(chip2_base + 0), 0); + gpiochips_writePad((brain_pin_e)(chip2_base + 1), 1); EXPECT_EQ(0x02, io_state); /* try to access failed chip */ - EXPECT_FALSE(gpiochips_writePad(chip3_base + 0, 0) >= 0); - EXPECT_FALSE(gpiochips_writePad(chip3_base + 1, 1) >= 0); + EXPECT_FALSE(gpiochips_writePad((brain_pin_e)(chip3_base + 0), 0) >= 0); + EXPECT_FALSE(gpiochips_writePad((brain_pin_e)(chip3_base + 1), 1) >= 0); EXPECT_EQ(0, calls_to_failed_chip); /* read/write outside range */ - EXPECT_TRUE(gpiochips_readPad(chip1_base - 1) < 0); - EXPECT_TRUE(gpiochips_writePad(chip1_base - 1, 1) < 0); + EXPECT_TRUE(gpiochips_readPad((brain_pin_e)(chip1_base - 1)) < 0); + EXPECT_TRUE(gpiochips_writePad((brain_pin_e)(chip1_base - 1), 1) < 0); - EXPECT_TRUE(gpiochips_readPad(chip3_base + 16) < 0); - EXPECT_TRUE(gpiochips_writePad(chip3_base + 16, 1) < 0); + EXPECT_TRUE(gpiochips_readPad((brain_pin_e)(chip3_base + 16)) < 0); + EXPECT_TRUE(gpiochips_writePad((brain_pin_e)(chip3_base + 16), 1) < 0); } diff --git a/unit_tests/tests/test_on_demand_parameters.cpp b/unit_tests/tests/test_on_demand_parameters.cpp index 0c8f95420b..a6372a7d65 100644 --- a/unit_tests/tests/test_on_demand_parameters.cpp +++ b/unit_tests/tests/test_on_demand_parameters.cpp @@ -47,8 +47,9 @@ TEST(util, checkForMissingParameterHandling) { FAIL() << "Expected 'missing key3' exception"; } catch(string message) { // exception about missing value is expected - ASSERT_TRUE(message.find("No value for this key") >= 0); - ASSERT_TRUE(message.find("key3") >= 0); + // type limits this to always be not negative + // todo? do we need this? ASSERT_TRUE(message.find("No value for this key") >= 0); + // todo? do we need this? ASSERT_TRUE(message.find("key3") >= 0); } }