• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* libcoap unit tests
2  *
3  * Copyright (C) 2012-2021 Olaf Bergmann <bergmann@tzi.org>
4  *
5  * SPDX-License-Identifier: BSD-2-Clause
6  *
7  * This file is part of the CoAP library libcoap. Please see
8  * README for terms of use.
9  */
10 
11 #include <stdio.h>
12 
13 #include <CUnit/CUnit.h>
14 #include <CUnit/Basic.h>
15 
16 #include "test_common.h"
17 #include "test_uri.h"
18 #include "test_encode.h"
19 #include "test_options.h"
20 #include "test_pdu.h"
21 #include "test_error_response.h"
22 #include "test_session.h"
23 #include "test_sendqueue.h"
24 #include "test_wellknown.h"
25 #include "test_tls.h"
26 
27 int
main(int argc COAP_UNUSED,char ** argv COAP_UNUSED)28 main(int argc COAP_UNUSED, char **argv COAP_UNUSED) {
29   CU_ErrorCode result;
30   CU_BasicRunMode run_mode = CU_BRM_VERBOSE;
31 
32   if (CU_initialize_registry() != CUE_SUCCESS) {
33     fprintf(stderr, "E: test framework initialization failed\n");
34     return -2;
35   }
36 
37   coap_startup();
38   t_init_uri_tests();
39   t_init_encode_tests();
40   t_init_option_tests();
41   t_init_pdu_tests();
42   t_init_error_response_tests();
43   t_init_session_tests();
44   t_init_sendqueue_tests();
45   t_init_wellknown_tests();
46   t_init_tls_tests();
47 
48   CU_basic_set_mode(run_mode);
49   result = CU_basic_run_tests();
50 
51   CU_cleanup_registry();
52   coap_cleanup();
53 
54   return result;
55 }
56