]>
git.proxmox.com Git - mirror_frr.git/blob - pceplib/test/pcep_msg_object_error_types_test.c
1 // SPDX-License-Identifier: LGPL-2.1-or-later
3 * This file is part of the PCEPlib, a PCEP protocol library.
5 * Copyright (C) 2020 Volta Networks https://voltanet.io/
7 * Author : Brady Johnson <brady@voltanet.io>
18 #include <CUnit/CUnit.h>
20 #include "pcep_msg_object_error_types.h"
21 #include "pcep_msg_object_error_types_test.h"
22 #include "pcep_utils_logging.h"
23 #include "pcep_utils_memory.h"
25 int pcep_object_error_types_test_suite_setup(void)
27 pceplib_memory_reset();
28 set_logging_level(LOG_DEBUG
);
32 int pcep_object_error_types_test_suite_teardown(void)
35 pceplib_memory_dump();
39 void pcep_object_error_types_test_setup(void)
43 void pcep_object_error_types_test_teardown(void)
47 void test_get_error_type_str()
49 const char *error_type_str
;
51 for (; i
< MAX_ERROR_TYPE
; i
++) {
52 error_type_str
= get_error_type_str(i
);
53 CU_ASSERT_PTR_NOT_NULL(error_type_str
);
56 CU_ASSERT_PTR_NULL(get_error_type_str(-1));
57 CU_ASSERT_PTR_NULL(get_error_type_str(MAX_ERROR_TYPE
));
60 void test_get_error_value_str()
62 const char *error_value_str
;
65 for (; i
< MAX_ERROR_TYPE
; i
++) {
66 for (; j
< MAX_ERROR_VALUE
; j
++) {
67 error_value_str
= get_error_value_str(i
, j
);
68 CU_ASSERT_PTR_NOT_NULL(error_value_str
);
72 CU_ASSERT_PTR_NULL(get_error_value_str(-1, 0));
73 CU_ASSERT_PTR_NULL(get_error_value_str(MAX_ERROR_TYPE
, 0));
74 CU_ASSERT_PTR_NULL(get_error_value_str(1, -1));
75 CU_ASSERT_PTR_NULL(get_error_value_str(1, MAX_ERROR_VALUE
));