+// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* 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 <assert.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
CU_ASSERT_PTR_NOT_NULL(encoded_msg);
struct pcep_message *open_msg = pcep_decode_message(encoded_msg);
CU_ASSERT_PTR_NOT_NULL(open_msg);
+ assert(open_msg != NULL);
/* Should be an Open, with no TLVs: length = 12 */
CU_ASSERT_EQUAL(open_msg->msg_header->type, PCEP_TYPE_OPEN);
CU_ASSERT_EQUAL(open_msg->encoded_message_length, 12);
mock_info->send_message_save_message = true;
session = create_pcep_session_ipv6(&config, &pce_ip);
CU_ASSERT_PTR_NOT_NULL(session);
+ assert(session != NULL);
CU_ASSERT_TRUE(session->socket_comm_session->is_ipv6);
/* What gets saved in the mock is the msg byte buffer. The msg struct
* was deleted when it was sent. Instead of inspecting the msg byte
CU_ASSERT_PTR_NOT_NULL(encoded_msg);
struct pcep_message *open_msg = pcep_decode_message(encoded_msg);
CU_ASSERT_PTR_NOT_NULL(open_msg);
+ assert(open_msg != NULL);
/* Should be an Open, with no TLVs: length = 12 */
CU_ASSERT_EQUAL(open_msg->msg_header->type, PCEP_TYPE_OPEN);
CU_ASSERT_EQUAL(open_msg->encoded_message_length, 12);
CU_ASSERT_PTR_NOT_NULL(encoded_msg);
open_msg = pcep_decode_message(encoded_msg);
CU_ASSERT_PTR_NOT_NULL(open_msg);
+ assert(open_msg != NULL);
/* Get and verify the Open Message objects */
CU_ASSERT_PTR_NOT_NULL(open_msg->obj_list);
+ assert(open_msg->obj_list != NULL);
CU_ASSERT_TRUE(open_msg->obj_list->num_entries > 0);
/* Get and verify the Open object */
open_obj = pcep_obj_get(open_msg->obj_list, PCEP_OBJ_CLASS_OPEN);
CU_ASSERT_PTR_NOT_NULL(open_obj);
/* Get and verify the Open object TLVs */
CU_ASSERT_PTR_NOT_NULL(open_obj->tlv_list);
+ assert(open_obj->tlv_list != NULL);
CU_ASSERT_EQUAL(open_obj->tlv_list->num_entries, 1);
CU_ASSERT_EQUAL(((struct pcep_object_tlv_header *)
open_obj->tlv_list->head->data)
CU_ASSERT_PTR_NOT_NULL(open_msg);
/* Get and verify the Open Message objects */
CU_ASSERT_PTR_NOT_NULL(open_msg->obj_list);
+ assert(open_msg != NULL);
CU_ASSERT_TRUE(open_msg->obj_list->num_entries > 0);
/* Get and verify the Open object */
open_obj = pcep_obj_get(open_msg->obj_list, PCEP_OBJ_CLASS_OPEN);
CU_ASSERT_PTR_NOT_NULL(open_obj);
/* Get and verify the Open object TLVs */
CU_ASSERT_PTR_NOT_NULL(open_obj->tlv_list);
+ assert(open_obj->tlv_list != NULL);
CU_ASSERT_EQUAL(open_obj->tlv_list->num_entries, 2);
CU_ASSERT_EQUAL(((struct pcep_object_tlv_header *)
open_obj->tlv_list->head->data)
CU_ASSERT_PTR_NOT_NULL(encoded_msg);
open_msg = pcep_decode_message(encoded_msg);
CU_ASSERT_PTR_NOT_NULL(open_msg);
+ assert(open_msg != NULL);
/* Get and verify the Open Message objects */
CU_ASSERT_PTR_NOT_NULL(open_msg->obj_list);
+ assert(open_msg->obj_list != NULL);
CU_ASSERT_TRUE(open_msg->obj_list->num_entries > 0);
/* Get and verify the Open object */
open_obj = pcep_obj_get(open_msg->obj_list, PCEP_OBJ_CLASS_OPEN);
CU_ASSERT_PTR_NOT_NULL(open_obj);
/* Get and verify the Open object TLVs */
CU_ASSERT_PTR_NOT_NULL(open_obj->tlv_list);
+ assert(open_obj->tlv_list != NULL);
CU_ASSERT_EQUAL(open_obj->tlv_list->num_entries, 3);
double_linked_list_node *tlv_node = open_obj->tlv_list->head;
CU_ASSERT_EQUAL(((struct pcep_object_tlv_header *)tlv_node->data)->type,
/* Get and verify the Open Message */
encoded_msg = dll_delete_first_node(mock_info->sent_message_list);
CU_ASSERT_PTR_NOT_NULL(encoded_msg);
+ assert(encoded_msg != NULL);
open_msg = pcep_decode_message(encoded_msg);
CU_ASSERT_PTR_NOT_NULL(open_msg);
+ assert(open_msg != NULL);
/* Get and verify the Open Message objects */
CU_ASSERT_PTR_NOT_NULL(open_msg->obj_list);
+ assert(open_msg->obj_list != NULL);
CU_ASSERT_TRUE(open_msg->obj_list->num_entries > 0);
/* Get and verify the Open object */
open_obj = pcep_obj_get(open_msg->obj_list, PCEP_OBJ_CLASS_OPEN);
CU_ASSERT_PTR_NOT_NULL(open_obj);
+ assert(open_obj != NULL);
/* Get and verify the Open object TLVs */
CU_ASSERT_PTR_NOT_NULL(open_obj->tlv_list);
+ assert(open_obj->tlv_list != NULL);
CU_ASSERT_EQUAL(open_obj->tlv_list->num_entries, 4);
tlv_node = open_obj->tlv_list->head;
CU_ASSERT_EQUAL(((struct pcep_object_tlv_header *)tlv_node->data)->type,