From: Bartosz Golaszewski Date: Wed, 22 Feb 2017 09:44:33 +0000 (+0100) Subject: tests: new assertion helper X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a12b50f8fa16c7683b05a64480e1ef0bced082db;p=qemu-gpiodev%2Flibgpiod.git tests: new assertion helper Add the GU_ASSERT_RET_OK() macro which checks if an integer (normally returned from a function call) equals 0 - indicating a correct result. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/unit/gpiod-unit.h b/tests/unit/gpiod-unit.h index 4c0aff9..bda0bd0 100644 --- a/tests/unit/gpiod-unit.h +++ b/tests/unit/gpiod-unit.h @@ -88,6 +88,7 @@ void gu_free_chip_iter(struct gpiod_chip_iter **iter); } while (0) #define GU_ASSERT_NOT_NULL(ptr) GU_ASSERT(ptr != NULL) +#define GU_ASSERT_RET_OK(status) GU_ASSERT(status == 0) #define GU_ASSERT_NULL(ptr) GU_ASSERT(ptr == NULL) #define GU_ASSERT_EQ(a1, a2) GU_ASSERT(a1 == a2) #define GU_ASSERT_STR_EQ(s1, s2) GU_ASSERT(strcmp(s1, s2) == 0)