2 * This file is part of the PCEPlib, a PCEP protocol library.
4 * Copyright (C) 2020 Volta Networks https://voltanet.io/
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * Author : Brady Johnson <brady@voltanet.io>
28 #include <CUnit/Basic.h>
29 #include <CUnit/CUnit.h>
30 #include <CUnit/TestDB.h>
32 #include "pcep_pcc_api_test.h"
34 int main(int argc
, char **argv
)
36 /* Unused parameters cause compilation warnings */
40 CU_initialize_registry();
43 * Tests defined in pcep_socket_comm_test.c
45 CU_pSuite test_pcc_api_suite
= CU_add_suite_with_setup_and_teardown(
46 "PCEP PCC API Test Suite",
47 pcep_pcc_api_test_suite_setup
, // suite setup and cleanup
49 pcep_pcc_api_test_suite_teardown
,
50 pcep_pcc_api_test_setup
, // test case setup function pointer
51 pcep_pcc_api_test_teardown
); // test case teardown function
54 CU_add_test(test_pcc_api_suite
, "test_initialize_pcc",
56 CU_add_test(test_pcc_api_suite
, "test_connect_pce", test_connect_pce
);
57 CU_add_test(test_pcc_api_suite
, "test_connect_pce_ipv6",
58 test_connect_pce_ipv6
);
59 CU_add_test(test_pcc_api_suite
, "test_connect_pce_with_src_ip",
60 test_connect_pce_with_src_ip
);
61 CU_add_test(test_pcc_api_suite
, "test_disconnect_pce",
63 CU_add_test(test_pcc_api_suite
, "test_send_message", test_send_message
);
64 CU_add_test(test_pcc_api_suite
, "test_event_queue", test_event_queue
);
65 CU_add_test(test_pcc_api_suite
, "test_get_event_type_str",
66 test_get_event_type_str
);
69 * Run the tests and cleanup.
71 CU_basic_set_mode(CU_BRM_VERBOSE
);
73 CU_FailureRecord
*failure_record
= CU_get_failure_list();
74 if (failure_record
!= NULL
) {
75 printf("\nFailed tests:\n\t [Suite] [Test] [File:line-number]\n");
77 printf("\t [%s] [%s] [%s:%d]\n",
78 failure_record
->pSuite
->pName
,
79 failure_record
->pTest
->pName
,
80 failure_record
->strFileName
,
81 failure_record
->uiLineNumber
);
82 failure_record
= failure_record
->pNext
;
84 } while (failure_record
!= NULL
);
87 CU_pRunSummary run_summary
= CU_get_run_summary();
88 int result
= run_summary
->nTestsFailed
;
89 CU_cleanup_registry();