Add isds_box_state_period structure
[libisds.git] / test / offline / context.c
bloba0e788c8f35a8d6f6c6bac90c6e093c362ecacbd
1 #include "../test.h"
2 #include "isds.h"
4 static int test_create(struct isds_ctx **context) {
5 if (!context)
6 FAIL_TEST("Bad invocation");
8 *context = isds_ctx_create();
9 if (!*context)
10 FAIL_TEST("isds_ctx_create() failed");
12 PASS_TEST;
15 static int test_free(const isds_error error, struct isds_ctx **context) {
16 if (!context)
17 FAIL_TEST("Bad invocation");
19 if (error != isds_ctx_free(context))
20 FAIL_TEST("Wrong return code");
22 if (*context)
23 FAIL_TEST("context not NULLed");
25 PASS_TEST;
29 int main(void) {
30 INIT_TEST("context");
32 struct isds_ctx *context = NULL;
34 if (isds_init())
35 ABORT_UNIT("isds_init() failed\n");
37 TEST("create", test_create, &context);
38 TEST("free valid context", test_free, IE_SUCCESS, &context);
40 context = NULL;
41 TEST("free invalid context", test_free, IE_INVALID_CONTEXT, &context);
43 isds_cleanup();
45 SUM_TEST();