Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy #62

Merged
merged 1 commit into from
Aug 5, 2024
Merged

tidy #62

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_cobs_decode_tinyframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ TEST_CASE("Decode: Inplace == External") {
SUBCASE("Fill with one/zero pattern") {
for (auto i{ 0u }; i < inplace.size() - 2; ++i) {
inplace[0] = COBS_TINYFRAME_SENTINEL_VALUE;
for (auto j = 1u; j < i; ++j) {
for (auto j{ 1u }; j < i; ++j) {
inplace[j] = (j & 1) ^ 1;
}
inplace[i + 1] = COBS_TINYFRAME_SENTINEL_VALUE;
Expand Down
12 changes: 6 additions & 6 deletions tests/test_cobs_encode_inc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ TEST_CASE("cobs_encode_inc") {
.code_idx = 0,
.code = 0,
.need_advance = 0 };
size_t const enc_max{ 1024 };
size_t constexpr enc_max{ 1024 };
byte_vec_t enc_buf(enc_max);
size_t const dec_max{ 1024 };
size_t constexpr dec_max{ 1024 };
byte_vec_t dec_buf(dec_max);

REQUIRE(cobs_encode_inc_begin(enc_buf.data(), enc_max, &ctx) == COBS_RET_SUCCESS);
Expand Down Expand Up @@ -136,7 +136,7 @@ TEST_CASE("cobs_encode_inc") {

TEST_CASE("cobs_encode_inc_end") {
cobs_enc_ctx_t ctx;
size_t const enc_max{ 1024 };
size_t constexpr enc_max{ 1024 };
byte_vec_t enc_buf(enc_max);
size_t enc_len;

Expand Down Expand Up @@ -218,9 +218,9 @@ void require_equal(byte_vec_t const &v1, byte_vec_t const &v2) {

TEST_CASE("Single/multi-encode equivalences") {
cobs_enc_ctx_t ctx;
size_t const enc_max{ 4096 };
size_t constexpr enc_max{ 4096 };
byte_vec_t enc_buf(enc_max);
size_t const dec_max{ 4096 };
size_t constexpr dec_max{ 4096 };
byte_vec_t dec_buf(dec_max);

REQUIRE(cobs_encode_inc_begin(enc_buf.data(), enc_max, &ctx) == COBS_RET_SUCCESS);
Expand Down Expand Up @@ -288,7 +288,7 @@ TEST_CASE("Single/multi-encode equivalences") {
}

SUBCASE("Header / payload split") {
byte_t const h[]{ 0x02, 0x03, 0xCC, 0xDF, 0x13, 0x49 };
byte_t constexpr h[]{ 0x02, 0x03, 0xCC, 0xDF, 0x13, 0x49 };

dec_buf.resize(400);
std::iota(std::begin(dec_buf), std::end(dec_buf), byte_t{ 0x01 });
Expand Down
16 changes: 8 additions & 8 deletions tests/test_cobs_encode_tinyframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <cstring>
#include <numeric>

static constexpr byte_t CSV = COBS_TINYFRAME_SENTINEL_VALUE;
static constexpr byte_t CSV{ COBS_TINYFRAME_SENTINEL_VALUE };

namespace {
cobs_ret_t cobs_encode_vec(byte_vec_t &v) {
Expand Down Expand Up @@ -148,30 +148,30 @@ TEST_CASE("Encode: Inplace == External") {
byte_t inplace[COBS_TINYFRAME_SAFE_BUFFER_SIZE];

SUBCASE("Fill with zeros") {
for (auto i = 0u; i < sizeof(inplace) - 2; ++i) {
for (auto i{ 0u }; i < sizeof(inplace) - 2; ++i) {
fill_inplace(inplace, i, 0x00);
verify_encode_inplace(inplace, i);
}
}

SUBCASE("Fill with nonzeros") {
for (auto i = 0u; i < sizeof(inplace) - 2; ++i) {
for (auto i{ 0u }; i < sizeof(inplace) - 2; ++i) {
fill_inplace(inplace, i, 0x01);
verify_encode_inplace(inplace, i);
}
}

SUBCASE("Fill with 0xFF") {
for (auto i = 0u; i < sizeof(inplace) - 2; ++i) {
for (auto i{ 0u }; i < sizeof(inplace) - 2; ++i) {
fill_inplace(inplace, i, 0xFF);
verify_encode_inplace(inplace, i);
}
}

SUBCASE("Fill with zero/one pattern") {
for (auto i = 0u; i < sizeof(inplace) - 2; ++i) {
for (auto i{ 0u }; i < sizeof(inplace) - 2; ++i) {
inplace[0] = COBS_TINYFRAME_SENTINEL_VALUE;
for (auto j = 1u; j < i; ++j) {
for (auto j{ 1u }; j < i; ++j) {
inplace[j] = j & 1;
}
inplace[i + 1] = COBS_TINYFRAME_SENTINEL_VALUE;
Expand All @@ -180,9 +180,9 @@ TEST_CASE("Encode: Inplace == External") {
}

SUBCASE("Fill with one/zero pattern") {
for (auto i = 0u; i < sizeof(inplace) - 2; ++i) {
for (auto i{ 0u }; i < sizeof(inplace) - 2; ++i) {
inplace[0] = COBS_TINYFRAME_SENTINEL_VALUE;
for (auto j = 1u; j < i; ++j) {
for (auto j{ 1u }; j < i; ++j) {
inplace[j] = (j & 1) ^ 1;
}
inplace[i + 1] = COBS_TINYFRAME_SENTINEL_VALUE;
Expand Down