blob: b1463751d6d0b1e864b0d6cd7647a45d97ba061c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/*
* This file is part of the PCEPlib, a PCEP protocol library.
*
* Copyright (C) 2020 Volta Networks https://voltanet.io/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Author : Brady Johnson <brady@voltanet.io>
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <CUnit/CUnit.h>
#include "pcep_msg_object_error_types.h"
#include "pcep_msg_object_error_types_test.h"
#include "pcep_utils_logging.h"
#include "pcep_utils_memory.h"
int pcep_object_error_types_test_suite_setup(void)
{
pceplib_memory_reset();
set_logging_level(LOG_DEBUG);
return 0;
}
int pcep_object_error_types_test_suite_teardown(void)
{
printf("\n");
pceplib_memory_dump();
return 0;
}
void pcep_object_error_types_test_setup(void)
{
}
void pcep_object_error_types_test_teardown(void)
{
}
void test_get_error_type_str()
{
const char *error_type_str;
int i = 0;
for (; i < MAX_ERROR_TYPE; i++) {
error_type_str = get_error_type_str(i);
CU_ASSERT_PTR_NOT_NULL(error_type_str);
}
CU_ASSERT_PTR_NULL(get_error_type_str(-1));
CU_ASSERT_PTR_NULL(get_error_type_str(MAX_ERROR_TYPE));
}
void test_get_error_value_str()
{
const char *error_value_str;
int i = 0, j = 0;
for (; i < MAX_ERROR_TYPE; i++) {
for (; j < MAX_ERROR_VALUE; j++) {
error_value_str = get_error_value_str(i, j);
CU_ASSERT_PTR_NOT_NULL(error_value_str);
}
}
CU_ASSERT_PTR_NULL(get_error_value_str(-1, 0));
CU_ASSERT_PTR_NULL(get_error_value_str(MAX_ERROR_TYPE, 0));
CU_ASSERT_PTR_NULL(get_error_value_str(1, -1));
CU_ASSERT_PTR_NULL(get_error_value_str(1, MAX_ERROR_VALUE));
}
|