test: Add tests for isd_get_commercial_credit()
[libisds.git] / test / offline / isds_envelope_free.c
blobf50a3c9713fc3f88323e3e98ca657b1e96ba4876
1 #include "../test.h"
2 #include "isds.h"
4 static int test_isds_envelope_free(
5 struct isds_envelope **envelope) {
6 isds_envelope_free(envelope);
7 if (!envelope) PASS_TEST;
9 if (*envelope)
10 FAIL_TEST("isds_envelope_free() did not null pointer");
12 PASS_TEST;
16 int main(int argc, char **argv) {
18 INIT_TEST("isds_envelope_free()");
19 if (isds_init())
20 ABORT_UNIT("isds_init() failed");
22 struct isds_envelope *envelope = NULL;
23 TEST("NULL", test_isds_envelope_free, NULL);
24 TEST("*NULL", test_isds_envelope_free, &envelope);
26 TEST_CALLOC(envelope);
27 TEST("Empty structure", test_isds_envelope_free, &envelope);
29 TEST_CALLOC(envelope);
30 TEST_FILL_STRING(envelope->dmID);
31 TEST_FILL_STRING(envelope->dbIDSender);
32 TEST_FILL_STRING(envelope->dmSender);
33 TEST_FILL_STRING(envelope->dmSenderAddress);
34 TEST_FILL_INT(envelope->dmSenderType);
35 TEST_FILL_STRING(envelope->dmRecipient);
36 TEST_FILL_STRING(envelope->dmRecipientAddress);
37 TEST_FILL_INT(envelope->dmAmbiguousRecipient);
39 TEST_FILL_INT(envelope->dmOrdinal);
40 TEST_FILL_INT(envelope->dmMessageStatus);
41 TEST_FILL_INT(envelope->dmAttachmentSize);
42 TEST_CALLOC(envelope->dmDeliveryTime); /* Time of delivery into a box */
43 TEST_CALLOC(envelope->dmAcceptanceTime); /* Time of acceptance */
44 TEST_CALLOC(envelope->hash); /* Message hash */
45 TEST_CALLOC(envelope->timestamp); /* Qualified time stamp */
46 TEST_CALLOC(envelope->events); /* Events message passed trough */
48 TEST_FILL_STRING(envelope->dmSenderOrgUnit);
49 TEST_FILL_INT(envelope->dmSenderOrgUnitNum);
50 TEST_FILL_STRING(envelope->dbIDRecipient);
51 TEST_FILL_STRING(envelope->dmRecipientOrgUnit);
52 TEST_FILL_INT(envelope->dmRecipientOrgUnitNum);
54 TEST("Full structure", test_isds_envelope_free, &envelope);
56 isds_cleanup();
57 SUM_TEST();