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>
24 #include <CUnit/Basic.h>
25 #include <CUnit/CUnit.h>
26 #include <CUnit/TestDB.h>
28 #include "pcep_pcc_api_test.h"
30 int main(int argc
, char **argv
)
32 /* Unused parameters cause compilation warnings */
36 CU_initialize_registry();
39 * Tests defined in pcep_socket_comm_test.c
41 CU_pSuite test_pcc_api_suite
= CU_add_suite_with_setup_and_teardown(
42 "PCEP PCC API Test Suite",
43 pcep_pcc_api_test_suite_setup
, // suite setup and cleanup
45 pcep_pcc_api_test_suite_teardown
,
46 pcep_pcc_api_test_setup
, // test case setup function pointer
47 pcep_pcc_api_test_teardown
); // test case teardown function
50 CU_add_test(test_pcc_api_suite
, "test_initialize_pcc",
52 CU_add_test(test_pcc_api_suite
, "test_connect_pce", test_connect_pce
);
53 CU_add_test(test_pcc_api_suite
, "test_connect_pce_ipv6",
54 test_connect_pce_ipv6
);
55 CU_add_test(test_pcc_api_suite
, "test_connect_pce_with_src_ip",
56 test_connect_pce_with_src_ip
);
57 CU_add_test(test_pcc_api_suite
, "test_disconnect_pce",
59 CU_add_test(test_pcc_api_suite
, "test_send_message", test_send_message
);
60 CU_add_test(test_pcc_api_suite
, "test_event_queue", test_event_queue
);
61 CU_add_test(test_pcc_api_suite
, "test_get_event_type_str",
62 test_get_event_type_str
);
65 * Run the tests and cleanup.
67 CU_basic_set_mode(CU_BRM_VERBOSE
);
69 CU_FailureRecord
*failure_record
= CU_get_failure_list();
70 if (failure_record
!= NULL
) {
71 printf("\nFailed tests:\n\t [Suite] [Test] [File:line-number]\n");
73 printf("\t [%s] [%s] [%s:%d]\n",
74 failure_record
->pSuite
->pName
,
75 failure_record
->pTest
->pName
,
76 failure_record
->strFileName
,
77 failure_record
->uiLineNumber
);
78 failure_record
= failure_record
->pNext
;
80 } while (failure_record
!= NULL
);
83 CU_pRunSummary run_summary
= CU_get_run_summary();
84 int result
= run_summary
->nTestsFailed
;
85 CU_cleanup_registry();