Added AlignAfterOpenBracket: AlwaysBreak and BinPackArguments: true to clang-format. Updated test/bacnet c/h files with updated format.
This commit is contained in:
@@ -82,7 +82,7 @@ int bip6_send_mpdu(BACNET_IP6_ADDRESS *dest, uint8_t *mtu, uint16_t mtu_len)
|
||||
Test_Sent_Message_Length = message_length;
|
||||
bvlc6_address_copy(&Test_Sent_Message_Dest, dest);
|
||||
if ((header_len == 4) && (mtu_len >= 4)) {
|
||||
memcpy(&Test_Sent_Message_Buffer[0], &mtu[4], mtu_len-4);
|
||||
memcpy(&Test_Sent_Message_Buffer[0], &mtu[4], mtu_len - 4);
|
||||
Test_Sent_Message_Buffer_Length = mtu_len - 4;
|
||||
} else {
|
||||
Test_Sent_Message_Buffer_Length = 0;
|
||||
@@ -126,22 +126,21 @@ static void test_setup(void)
|
||||
{
|
||||
bvlc6_init();
|
||||
/* BACnet_IPv6_Multicast_Address is FF02::BAC0 */
|
||||
bvlc6_address_set(&TD.BIP6_Broadcast_Addr,
|
||||
BIP6_MULTICAST_LINK_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
bvlc6_address_set(
|
||||
&TD.BIP6_Broadcast_Addr, BIP6_MULTICAST_LINK_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
bvlc6_address_set(&TD.BIP6_Addr,
|
||||
0x2001, 0x0DBB, 0xAC10, 0xFE01, 0, 0, 0,
|
||||
bvlc6_address_set(
|
||||
&TD.BIP6_Addr, 0x2001, 0x0DBB, 0xAC10, 0xFE01, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
TD.Device_ID = 12345;
|
||||
bvlc6_vmac_address_set(&TD.BACnet_Address, TD.Device_ID);
|
||||
|
||||
|
||||
/* BACnet_IPv6_Multicast_Address is FF02::BAC0 */
|
||||
bvlc6_address_set(&IUT.BIP6_Broadcast_Addr,
|
||||
BIP6_MULTICAST_LINK_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
bvlc6_address_set(
|
||||
&IUT.BIP6_Broadcast_Addr, BIP6_MULTICAST_LINK_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
bvlc6_address_set(&IUT.BIP6_Addr,
|
||||
0x2001, 0x0DBB, 0xAC10, 0xFE01, 0, 0, 1,
|
||||
bvlc6_address_set(
|
||||
&IUT.BIP6_Addr, 0x2001, 0x0DBB, 0xAC10, 0xFE01, 0, 0, 1,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
IUT.Device_ID = 54321;
|
||||
bvlc6_vmac_address_set(&IUT.BACnet_Address, IUT.Device_ID);
|
||||
@@ -157,13 +156,13 @@ static void test_cleanup(void)
|
||||
*/
|
||||
static void test_Initiate_Original_Broadcast_NPDU(void)
|
||||
{
|
||||
uint8_t pdu[MAX_MPDU] = {0};
|
||||
uint8_t pdu[MAX_MPDU] = { 0 };
|
||||
int npdu_len = 0;
|
||||
int apdu_len = 0;
|
||||
int pdu_len = 0;
|
||||
BACNET_ADDRESS dest = {0};
|
||||
BACNET_NPDU_DATA npdu_data = {0};
|
||||
uint8_t test_pdu[MAX_MPDU] = {0};
|
||||
BACNET_ADDRESS dest = { 0 };
|
||||
BACNET_NPDU_DATA npdu_data = { 0 };
|
||||
uint8_t test_pdu[MAX_MPDU] = { 0 };
|
||||
uint16_t test_pdu_len = 0;
|
||||
uint32_t test_vmac_src = 0;
|
||||
int function_len = 0;
|
||||
@@ -173,17 +172,17 @@ static void test_Initiate_Original_Broadcast_NPDU(void)
|
||||
dest.net = BACNET_BROADCAST_NETWORK;
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
npdu_len = npdu_encode_pdu(&pdu[0], &dest, &IUT.BACnet_Address, &npdu_data);
|
||||
apdu_len = iam_encode_apdu(&pdu[npdu_len], IUT.Device_ID, MAX_APDU,
|
||||
SEGMENTATION_NONE, BACNET_VENDOR_ID);
|
||||
apdu_len = iam_encode_apdu(
|
||||
&pdu[npdu_len], IUT.Device_ID, MAX_APDU, SEGMENTATION_NONE,
|
||||
BACNET_VENDOR_ID);
|
||||
pdu_len = npdu_len + apdu_len;
|
||||
bvlc6_send_pdu(&dest, &npdu_data, pdu, pdu_len);
|
||||
/* DA=Link Local Multicast Address */
|
||||
assert(!bvlc6_address_different(&TD.BIP6_Broadcast_Addr,
|
||||
&Test_Sent_Message_Dest));
|
||||
assert(!bvlc6_address_different(
|
||||
&TD.BIP6_Broadcast_Addr, &Test_Sent_Message_Dest));
|
||||
/* SA = IUT - done in port layer */
|
||||
/* Original-Broadcast-NPDU */
|
||||
assert(Test_Sent_Message_Type ==
|
||||
BVLC6_ORIGINAL_BROADCAST_NPDU);
|
||||
assert(Test_Sent_Message_Type == BVLC6_ORIGINAL_BROADCAST_NPDU);
|
||||
if (Test_Sent_Message_Type == BVLC6_ORIGINAL_BROADCAST_NPDU) {
|
||||
function_len = bvlc6_decode_original_broadcast(
|
||||
Test_Sent_Message_Buffer, Test_Sent_Message_Buffer_Length,
|
||||
@@ -203,7 +202,7 @@ static void test_Initiate_Original_Broadcast_NPDU(void)
|
||||
*/
|
||||
static void test_Execute_Virtual_Address_Resolution(void)
|
||||
{
|
||||
uint8_t mtu[MAX_MPDU] = {0};
|
||||
uint8_t mtu[MAX_MPDU] = { 0 };
|
||||
uint16_t mtu_len = 0;
|
||||
uint32_t test_vmac_src = 0;
|
||||
uint32_t test_vmac_dst = 0;
|
||||
@@ -214,13 +213,11 @@ static void test_Execute_Virtual_Address_Resolution(void)
|
||||
test_setup();
|
||||
mtu_len = bvlc6_encode_virtual_address_resolution(
|
||||
&mtu[0], sizeof(mtu), TD.Device_ID);
|
||||
result = bvlc6_bbmd_disabled_handler(&TD.BIP6_Addr, &TD.BACnet_Address,
|
||||
&mtu[0], mtu_len);
|
||||
result = bvlc6_bbmd_disabled_handler(
|
||||
&TD.BIP6_Addr, &TD.BACnet_Address, &mtu[0], mtu_len);
|
||||
assert(result == 0);
|
||||
assert(bvlc6_get_function_code() ==
|
||||
BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(Test_Sent_Message_Type ==
|
||||
BVLC6_VIRTUAL_ADDRESS_RESOLUTION_ACK);
|
||||
assert(bvlc6_get_function_code() == BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(Test_Sent_Message_Type == BVLC6_VIRTUAL_ADDRESS_RESOLUTION_ACK);
|
||||
assert(VMAC_Find_By_Key(TD.Device_ID) != NULL);
|
||||
if (Test_Sent_Message_Type == BVLC6_VIRTUAL_ADDRESS_RESOLUTION_ACK) {
|
||||
function_len = bvlc6_decode_virtual_address_resolution_ack(
|
||||
@@ -235,34 +232,31 @@ static void test_Execute_Virtual_Address_Resolution(void)
|
||||
TD.Device_ID += 42;
|
||||
mtu_len = bvlc6_encode_virtual_address_resolution(
|
||||
&mtu[0], sizeof(mtu), TD.Device_ID);
|
||||
result = bvlc6_bbmd_disabled_handler(&TD.BIP6_Addr, &TD.BACnet_Address,
|
||||
&mtu[0], mtu_len);
|
||||
result = bvlc6_bbmd_disabled_handler(
|
||||
&TD.BIP6_Addr, &TD.BACnet_Address, &mtu[0], mtu_len);
|
||||
assert(result == 0);
|
||||
assert(bvlc6_get_function_code() ==
|
||||
BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(bvlc6_get_function_code() == BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(VMAC_Find_By_Key(TD.Device_ID) != NULL);
|
||||
assert(VMAC_Find_By_Key(old_device_id) == NULL);
|
||||
/* change IPv6 address */
|
||||
mtu_len = bvlc6_encode_virtual_address_resolution(
|
||||
&mtu[0], sizeof(mtu), TD.Device_ID);
|
||||
bvlc6_address_set(&TD.BIP6_Addr,
|
||||
0x2001, 0x0DBB, 0xAC10, 0xFE01, 0, 0, 42,
|
||||
bvlc6_address_set(
|
||||
&TD.BIP6_Addr, 0x2001, 0x0DBB, 0xAC10, 0xFE01, 0, 0, 42,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
result = bvlc6_bbmd_disabled_handler(&TD.BIP6_Addr, &TD.BACnet_Address,
|
||||
&mtu[0], mtu_len);
|
||||
result = bvlc6_bbmd_disabled_handler(
|
||||
&TD.BIP6_Addr, &TD.BACnet_Address, &mtu[0], mtu_len);
|
||||
assert(result == 0);
|
||||
assert(bvlc6_get_function_code() ==
|
||||
BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(bvlc6_get_function_code() == BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(VMAC_Find_By_Key(TD.Device_ID) != NULL);
|
||||
/* repeat with same device ID and address */
|
||||
/* change IPv6 address */
|
||||
mtu_len = bvlc6_encode_virtual_address_resolution(
|
||||
&mtu[0], sizeof(mtu), TD.Device_ID);
|
||||
result = bvlc6_bbmd_disabled_handler(&TD.BIP6_Addr, &TD.BACnet_Address,
|
||||
&mtu[0], mtu_len);
|
||||
result = bvlc6_bbmd_disabled_handler(
|
||||
&TD.BIP6_Addr, &TD.BACnet_Address, &mtu[0], mtu_len);
|
||||
assert(result == 0);
|
||||
assert(bvlc6_get_function_code() ==
|
||||
BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(bvlc6_get_function_code() == BVLC6_VIRTUAL_ADDRESS_RESOLUTION);
|
||||
assert(VMAC_Find_By_Key(TD.Device_ID) != NULL);
|
||||
|
||||
test_cleanup();
|
||||
@@ -272,12 +266,14 @@ static void test_BBMD_Result(void)
|
||||
{
|
||||
int result = 0;
|
||||
uint32_t vmac_src = 0x1234;
|
||||
uint16_t result_code[6] = { BVLC6_RESULT_SUCCESSFUL_COMPLETION,
|
||||
uint16_t result_code[6] = {
|
||||
BVLC6_RESULT_SUCCESSFUL_COMPLETION,
|
||||
BVLC6_RESULT_ADDRESS_RESOLUTION_NAK,
|
||||
BVLC6_RESULT_VIRTUAL_ADDRESS_RESOLUTION_NAK,
|
||||
BVLC6_RESULT_REGISTER_FOREIGN_DEVICE_NAK,
|
||||
BVLC6_RESULT_DELETE_FOREIGN_DEVICE_NAK,
|
||||
BVLC6_RESULT_DISTRIBUTE_BROADCAST_TO_NETWORK_NAK };
|
||||
BVLC6_RESULT_DISTRIBUTE_BROADCAST_TO_NETWORK_NAK
|
||||
};
|
||||
uint16_t test_result_code = 0;
|
||||
uint8_t test_function_code = 0;
|
||||
BACNET_IP6_ADDRESS addr;
|
||||
@@ -286,7 +282,8 @@ static void test_BBMD_Result(void)
|
||||
uint8_t mtu[MAX_MPDU] = { 0 };
|
||||
uint16_t mtu_len = 0;
|
||||
|
||||
bvlc6_address_set(&addr, BIP6_MULTICAST_LINK_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
bvlc6_address_set(
|
||||
&addr, BIP6_MULTICAST_LINK_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
addr.port = 0xBAC0U;
|
||||
bvlc6_vmac_address_set(&src, vmac_src);
|
||||
|
||||
Reference in New Issue
Block a user