Run clang-format and enable CI check for it (#755)
* pre-commit: Update and enable clang-format check There is newer version from clang-format so use that. We do not yet want 18 as that is little bit too new. * Format some thing by hand which clang-format "breaks" Clang-format will format some things little bit off in some cases. Format some things by hand so we get cleaner end result. * Run clang-format with ``` pre-commit run --all-files clang-format ``` We have already in previously checked places where clang-format does not make good format and ignored those (hopefully most of the things). --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
@@ -1230,10 +1230,8 @@ static void testBACDCodeBitString(void)
|
||||
null_len = encode_application_bitstring(NULL, &value);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
/* decode */
|
||||
len = bacnet_bitstring_application_decode(
|
||||
apdu, null_len, &test_value);
|
||||
zassert_equal(
|
||||
bitstring_bits_used(&test_value), (bit + 1), NULL);
|
||||
len = bacnet_bitstring_application_decode(apdu, null_len, &test_value);
|
||||
zassert_equal(bitstring_bits_used(&test_value), (bit + 1), NULL);
|
||||
zassert_true(bitstring_bit(&test_value, bit), NULL);
|
||||
len = bacnet_tag_decode(apdu, len, &tag);
|
||||
zassert_true(len > 0, NULL);
|
||||
@@ -1247,26 +1245,22 @@ static void testBACDCodeBitString(void)
|
||||
zassert_false(bitstring_bit(&value, bit), NULL);
|
||||
/* encode */
|
||||
len = bacnet_bitstring_application_encode(apdu, sizeof(apdu), &value);
|
||||
null_len = bacnet_bitstring_application_encode(NULL, sizeof(apdu), &value);
|
||||
null_len =
|
||||
bacnet_bitstring_application_encode(NULL, sizeof(apdu), &value);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
/* decode */
|
||||
len = bacnet_bitstring_application_decode(
|
||||
apdu, null_len, &test_value);
|
||||
len = bacnet_bitstring_application_decode(apdu, null_len, &test_value);
|
||||
len = bacnet_tag_decode(apdu, len, &tag);
|
||||
zassert_true(len > 0, NULL);
|
||||
zassert_equal(tag.number, BACNET_APPLICATION_TAG_BIT_STRING, NULL);
|
||||
zassert_equal(
|
||||
bitstring_bits_used(&test_value), (bit + 1), NULL);
|
||||
zassert_equal(bitstring_bits_used(&test_value), (bit + 1), NULL);
|
||||
zassert_false(bitstring_bit(&test_value, bit), NULL);
|
||||
}
|
||||
/* test APDU size limits */
|
||||
apdu_len =
|
||||
bacnet_bitstring_application_encode(apdu, sizeof(apdu), &value);
|
||||
null_len =
|
||||
bacnet_bitstring_application_encode(NULL, sizeof(apdu), &value);
|
||||
apdu_len = bacnet_bitstring_application_encode(apdu, sizeof(apdu), &value);
|
||||
null_len = bacnet_bitstring_application_encode(NULL, sizeof(apdu), &value);
|
||||
zassert_equal(apdu_len, null_len, NULL);
|
||||
test_len =
|
||||
bacnet_bitstring_application_decode(apdu, apdu_len, &test_value);
|
||||
test_len = bacnet_bitstring_application_decode(apdu, apdu_len, &test_value);
|
||||
zassert_equal(
|
||||
apdu_len, test_len, "test_len=%d apdu_len=%d", test_len, apdu_len);
|
||||
zassert_true(bitstring_same(&value, &test_value), NULL);
|
||||
@@ -1275,8 +1269,7 @@ static void testBACDCodeBitString(void)
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
}
|
||||
while (--apdu_len) {
|
||||
len =
|
||||
bacnet_bitstring_application_encode(apdu, apdu_len, &value);
|
||||
len = bacnet_bitstring_application_encode(apdu, apdu_len, &value);
|
||||
zassert_equal(len, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user