]>
Commit | Line | Data |
---|---|---|
74971473 JG |
1 | /* |
2 | * This file is part of the PCEPlib, a PCEP protocol library. | |
3 | * | |
4 | * Copyright (C) 2020 Volta Networks https://voltanet.io/ | |
5 | * | |
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. | |
10 | * | |
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. | |
15 | * | |
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/>. | |
18 | * | |
19 | * Author : Brady Johnson <brady@voltanet.io> | |
20 | * | |
21 | */ | |
22 | ||
23 | ||
24 | #include <CUnit/Basic.h> | |
25 | #include <CUnit/CUnit.h> | |
26 | #include <CUnit/TestDB.h> | |
27 | ||
28 | #include "pcep_pcc_api_test.h" | |
29 | ||
30 | int main(int argc, char **argv) | |
31 | { | |
32 | /* Unused parameters cause compilation warnings */ | |
33 | (void)argc; | |
34 | (void)argv; | |
35 | ||
36 | CU_initialize_registry(); | |
37 | ||
38 | /* | |
39 | * Tests defined in pcep_socket_comm_test.c | |
40 | */ | |
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 | |
44 | // function pointers | |
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 | |
48 | // pointer | |
49 | ||
50 | CU_add_test(test_pcc_api_suite, "test_initialize_pcc", | |
51 | 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", | |
58 | 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); | |
63 | ||
64 | /* | |
65 | * Run the tests and cleanup. | |
66 | */ | |
67 | CU_basic_set_mode(CU_BRM_VERBOSE); | |
68 | CU_basic_run_tests(); | |
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"); | |
72 | do { | |
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; | |
79 | ||
80 | } while (failure_record != NULL); | |
81 | } | |
82 | ||
83 | CU_pRunSummary run_summary = CU_get_run_summary(); | |
84 | int result = run_summary->nTestsFailed; | |
85 | CU_cleanup_registry(); | |
86 | ||
87 | return result; | |
88 | } |