test: Silent warnings in offile tests
[libisds.git] / test / offline / isds_credit_event_free.c
blobffaec4176744e7acc4d89779efb1dfdd463088f4
1 #include "../test.h"
2 #include "isds.h"
4 static int test_isds_credit_event_free(
5 struct isds_credit_event **event) {
6 isds_credit_event_free(event);
7 if (!event) PASS_TEST;
9 if (*event)
10 FAIL_TEST("isds_credit_event_free() did not null pointer");
12 PASS_TEST;
16 int main(void) {
17 INIT_TEST("isds_credit_event_free()");
18 if (isds_init())
19 ABORT_UNIT("isds_init() failed");
21 struct isds_credit_event *event = NULL;
22 TEST("NULL", test_isds_credit_event_free, NULL);
23 TEST("*NULL", test_isds_credit_event_free, &event);
25 TEST_CALLOC(event);
26 TEST("Empty structure", test_isds_credit_event_free, &event);
28 TEST_CALLOC(event);
29 TEST_CALLOC(event->time);
30 event->type = ISDS_CREDIT_CHARGED;
31 TEST_FILL_STRING(event->details.charged.transaction);
32 TEST("Full structure ISDS_CREDIT_CHARGED",
33 test_isds_credit_event_free, &event);
35 TEST_CALLOC(event);
36 TEST_CALLOC(event->time);
37 event->type = ISDS_CREDIT_DISCHARGED;
38 TEST_FILL_STRING(event->details.discharged.transaction);
39 TEST("Full structure ISDS_CREDIT_DISCHARGED",
40 test_isds_credit_event_free, &event);
42 TEST_CALLOC(event);
43 TEST_CALLOC(event->time);
44 event->type = ISDS_CREDIT_MESSAGE_SENT;
45 TEST_FILL_STRING(event->details.message_sent.recipient);
46 TEST_FILL_STRING(event->details.message_sent.message_id);
47 TEST("Full structure ISDS_CREDIT_MESSAGE_SENT",
48 test_isds_credit_event_free, &event);
50 TEST_CALLOC(event);
51 TEST_CALLOC(event->time);
52 event->type = ISDS_CREDIT_STORAGE_SET;
53 TEST_CALLOC(event->details.storage_set.new_valid_from);
54 TEST_CALLOC(event->details.storage_set.new_valid_to);
55 TEST_FILL_INT(event->details.storage_set.old_capacity);
56 TEST_CALLOC(event->details.storage_set.old_valid_from);
57 TEST_CALLOC(event->details.storage_set.old_valid_to);
58 TEST_FILL_STRING(event->details.storage_set.initiator);
59 TEST("Full structure ISDS_CREDIT_STORAGE_SET",
60 test_isds_credit_event_free, &event);
62 isds_cleanup();
63 SUM_TEST();