Added AlignAfterOpenBracket: AlwaysBreak and BinPackArguments: true to clang-format. Updated test/bacnet c/h files with updated format.

This commit is contained in:
Steve Karg
2024-04-24 09:38:12 -05:00
parent 1aaebe9414
commit 70c54817fd
120 changed files with 2182 additions and 1894 deletions
+32 -43
View File
@@ -22,9 +22,8 @@
/**
* @brief Test
*/
static void testBACnetRecipientData(
BACNET_RECIPIENT *data1,
BACNET_RECIPIENT *data2)
static void
testBACnetRecipientData(BACNET_RECIPIENT *data1, BACNET_RECIPIENT *data2)
{
unsigned i = 0;
@@ -34,32 +33,30 @@ static void testBACnetRecipientData(
zassert_equal(
data1->type.device.type, data2->type.device.type, NULL);
zassert_equal(
data1->type.device.instance,
data2->type.device.instance, NULL);
data1->type.device.instance, data2->type.device.instance, NULL);
} else if (data1->tag == BACNET_RECIPIENT_TAG_ADDRESS) {
zassert_equal(
data1->type.address.net, data2->type.address.net, NULL);
if (data1->type.address.net == BACNET_BROADCAST_NETWORK) {
zassert_equal(
data1->type.address.mac_len,
data2->type.address.mac_len, NULL);
data1->type.address.mac_len, data2->type.address.mac_len,
NULL);
} else if (data1->type.address.net) {
zassert_equal(
data1->type.address.len,
data2->type.address.len, NULL);
data1->type.address.len, data2->type.address.len, NULL);
for (i = 0; i < data1->type.address.len; i++) {
zassert_equal(
data1->type.address.adr[i],
data2->type.address.adr[i], NULL);
data1->type.address.adr[i], data2->type.address.adr[i],
NULL);
}
} else {
zassert_equal(
data1->type.address.mac_len,
data2->type.address.mac_len, NULL);
data1->type.address.mac_len, data2->type.address.mac_len,
NULL);
for (i = 0; i < data1->type.address.mac_len; i++) {
zassert_equal(
data1->type.address.mac[i],
data2->type.address.mac[i], NULL);
data1->type.address.mac[i], data2->type.address.mac[i],
NULL);
}
}
} else {
@@ -82,34 +79,28 @@ static void testBACnetDestination(void)
null_len = bacnet_destination_encode(NULL, &destination);
apdu_len = bacnet_destination_encode(apdu, &destination);
zassert_equal(apdu_len, null_len, NULL);
test_len = bacnet_destination_decode(apdu, apdu_len,
&test_destination);
test_len = bacnet_destination_decode(apdu, apdu_len, &test_destination);
zassert_equal(apdu_len, test_len, NULL);
destination.Recipient.tag = BACNET_RECIPIENT_TAG_ADDRESS;
null_len = bacnet_destination_encode(NULL, &destination);
apdu_len = bacnet_destination_encode(apdu, &destination);
zassert_equal(apdu_len, null_len, NULL);
test_len = bacnet_destination_decode(apdu, apdu_len,
&test_destination);
test_len = bacnet_destination_decode(apdu, apdu_len, &test_destination);
zassert_equal(test_len, apdu_len, NULL);
null_len = bacnet_destination_encode(NULL, &destination);
apdu_len = bacnet_destination_encode(apdu, &destination);
zassert_equal(apdu_len, null_len, NULL);
test_len = bacnet_destination_decode(apdu, apdu_len,
&test_destination);
test_len = bacnet_destination_decode(apdu, apdu_len, &test_destination);
zassert_equal(test_len, apdu_len, NULL);
/* decoding, some negative tests */
test_len = bacnet_destination_decode(NULL, apdu_len,
&test_destination);
test_len = bacnet_destination_decode(NULL, apdu_len, &test_destination);
zassert_equal(test_len, BACNET_STATUS_REJECT, NULL);
test_len = bacnet_destination_decode(apdu, 0,
&test_destination);
test_len = bacnet_destination_decode(apdu, 0, &test_destination);
zassert_equal(test_len, BACNET_STATUS_REJECT, NULL);
test_len = bacnet_destination_decode(apdu, apdu_len,
NULL);
test_len = bacnet_destination_decode(apdu, apdu_len, NULL);
zassert_equal(test_len, BACNET_STATUS_REJECT, NULL);
}
/**
@@ -117,8 +108,8 @@ static void testBACnetDestination(void)
*/
/**
* Unit Test for ASCII conversion
*/
* Unit Test for ASCII conversion
*/
#if defined(CONFIG_ZTEST_NEW_API)
ZTEST(bacnet_destination_tests, test_BACnetDestination_ASCII)
#else
@@ -128,13 +119,13 @@ static void test_BACnetDestination_ASCII(void)
BACNET_DESTINATION destination = { 0 }, test_destination = { 0 };
int len = 0, test_len = 0;
const char *ascii = "("
"ValidDays=[1,2,3,4,5,6,7];"
"FromTime=0:00:00.0;ToTime=23:59:59.99;"
"Recipient=Device(type=8,instance=4194303);"
"ProcessIdentifier=0;"
"ConfirmedNotify=false;"
"Transitions=[]"
")";
"ValidDays=[1,2,3,4,5,6,7];"
"FromTime=0:00:00.0;ToTime=23:59:59.99;"
"Recipient=Device(type=8,instance=4194303);"
"ProcessIdentifier=0;"
"ConfirmedNotify=false;"
"Transitions=[]"
")";
bool status = false;
char *test_ascii = NULL;
@@ -148,13 +139,12 @@ static void test_BACnetDestination_ASCII(void)
if (len > 0) {
test_ascii = calloc(len, 1);
if (test_ascii) {
test_len = bacnet_destination_to_ascii(
&test_destination, test_ascii, len);
test_len =
bacnet_destination_to_ascii(&test_destination, test_ascii, len);
zassert_equal(len, test_len, NULL);
free(test_ascii);
}
}
}
#if defined(CONFIG_ZTEST_NEW_API)
@@ -162,10 +152,9 @@ ZTEST_SUITE(bacnet_destination_tests, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(bacnet_destination_tests,
ztest_unit_test(testBACnetDestination),
ztest_unit_test(test_BACnetDestination_ASCII)
);
ztest_test_suite(
bacnet_destination_tests, ztest_unit_test(testBACnetDestination),
ztest_unit_test(test_BACnetDestination_ASCII));
ztest_run_test_suite(bacnet_destination_tests);
}