]>
git.proxmox.com Git - mirror_frr.git/blob - pceplib/test/pcep_msg_object_error_types_test.c
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>
30 #include <CUnit/CUnit.h>
32 #include "pcep_msg_object_error_types.h"
33 #include "pcep_msg_object_error_types_test.h"
34 #include "pcep_utils_logging.h"
35 #include "pcep_utils_memory.h"
37 int pcep_object_error_types_test_suite_setup(void)
39 pceplib_memory_reset();
40 set_logging_level(LOG_DEBUG
);
44 int pcep_object_error_types_test_suite_teardown(void)
47 pceplib_memory_dump();
51 void pcep_object_error_types_test_setup(void)
55 void pcep_object_error_types_test_teardown(void)
59 void test_get_error_type_str()
61 const char *error_type_str
;
63 for (; i
< MAX_ERROR_TYPE
; i
++) {
64 error_type_str
= get_error_type_str(i
);
65 CU_ASSERT_PTR_NOT_NULL(error_type_str
);
68 CU_ASSERT_PTR_NULL(get_error_type_str(-1));
69 CU_ASSERT_PTR_NULL(get_error_type_str(MAX_ERROR_TYPE
));
72 void test_get_error_value_str()
74 const char *error_value_str
;
77 for (; i
< MAX_ERROR_TYPE
; i
++) {
78 for (; j
< MAX_ERROR_VALUE
; j
++) {
79 error_value_str
= get_error_value_str(i
, j
);
80 CU_ASSERT_PTR_NOT_NULL(error_value_str
);
84 CU_ASSERT_PTR_NULL(get_error_value_str(-1, 0));
85 CU_ASSERT_PTR_NULL(get_error_value_str(MAX_ERROR_TYPE
, 0));
86 CU_ASSERT_PTR_NULL(get_error_value_str(1, -1));
87 CU_ASSERT_PTR_NULL(get_error_value_str(1, MAX_ERROR_VALUE
));