Make notification tests easier

This commit is contained in:
Benedikt Heine 2018-11-15 18:41:23 +01:00
parent 193b1f7202
commit 5284ce01f4

View File

@ -19,12 +19,9 @@ TEST test_notification_is_duplicate_field(char **field,
PASS(); PASS();
} }
TEST test_notification_is_duplicate(void *notifications) TEST test_notification_is_duplicate(struct notification *a,
struct notification *b)
{ {
struct notification **n = (struct notification**)notifications;
struct notification *a = n[0];
struct notification *b = n[1];
ASSERT(notification_is_duplicate(a, b)); ASSERT(notification_is_duplicate(a, b));
CHECK_CALL(test_notification_is_duplicate_field(&(b->appname), a, b)); CHECK_CALL(test_notification_is_duplicate_field(&(b->appname), a, b));
@ -172,11 +169,9 @@ SUITE(suite_notification)
b->urgency = URG_NORM; b->urgency = URG_NORM;
//2 equal notifications to be passed for duplicate checking, //2 equal notifications to be passed for duplicate checking,
struct notification *n[2] = {a, b}; RUN_TESTp(test_notification_is_duplicate, a, b);
g_clear_pointer(&a, notification_unref);
RUN_TEST1(test_notification_is_duplicate, (void*) n); g_clear_pointer(&b, notification_unref);
notification_unref(a);
notification_unref(b);
RUN_TEST(test_notification_replace_single_field); RUN_TEST(test_notification_replace_single_field);
RUN_TEST(test_notification_referencing); RUN_TEST(test_notification_referencing);