From: Alexander Stein Date: Wed, 7 Aug 2019 19:51:32 +0000 (+0200) Subject: bindings: cxx: add a workaround for --success run X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2967e9455694defafe616c3c38149408c915b61f;p=qemu-gpiodev%2Flibgpiod.git bindings: cxx: add a workaround for --success run If run with --success, all expressions are evaluated and printed out. But REQUIRE_FALSE(chip) tries to iterate over the chip resulting in this backtrace: [...] Work around this by forcing catch2 to call gpiod::chip::operator bool(). Signed-off-by: Alexander Stein Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/cxx/tests/tests-chip.cpp b/bindings/cxx/tests/tests-chip.cpp index c9eb8e5..1c69872 100644 --- a/bindings/cxx/tests/tests-chip.cpp +++ b/bindings/cxx/tests/tests-chip.cpp @@ -70,7 +70,7 @@ TEST_CASE("GPIO chip can be opened with the open() method in different modes", " mockup::probe_guard mockup_chips({ 8, 8, 8 }); ::gpiod::chip chip; - REQUIRE_FALSE(chip); + REQUIRE_FALSE(!!chip); SECTION("open by name") { @@ -102,7 +102,7 @@ TEST_CASE("Uninitialized GPIO chip behaves correctly", "[chip]") SECTION("uninitialized chip is 'false'") { - REQUIRE_FALSE(chip); + REQUIRE_FALSE(!!chip); } SECTION("using uninitialized chip throws logic_error") @@ -149,7 +149,7 @@ TEST_CASE("Chip object can be reset", "[chip]") ::gpiod::chip chip(mockup::instance().chip_name(0)); REQUIRE(chip); chip.reset(); - REQUIRE_FALSE(chip); + REQUIRE_FALSE(!!chip); } TEST_CASE("Chip info can be correctly retrieved", "[chip]")