}
static int test_string_startswith(const struct test* t) {
- ASSERT_SUCCESS(pakfire_string_startswith("ABC", "A"));
- ASSERT_FAILURE(pakfire_string_startswith("ABC", "B"));
+ ASSERT_TRUE(pakfire_string_startswith("ABC", "A"));
+ ASSERT_FALSE(pakfire_string_startswith("ABC", "B"));
return EXIT_SUCCESS;
} \
} while (0)
+#define ASSERT_TRUE(expr) \
+ do { \
+ if (!(expr)) { \
+ LOG_ERROR("Failed assertion: " #expr " unexpectedly didn't return true in %s:%d: %m\n", \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ goto FAIL; \
+ } \
+ } while (0)
+
+#define ASSERT_FALSE(expr) \
+ do { \
+ if ((expr)) { \
+ LOG_ERROR("Failed assertion: " #expr " unexpectedly didn't return false in %s:%d: %m\n", \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ goto FAIL; \
+ } \
+ } while (0)
+
#define ASSERT_ERRNO(expr, e) \
do { \
if (!(expr)) { \