Skip to content

Commit

Permalink
🚨Fix clang-tidy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kammce committed Dec 10, 2024
1 parent 2664fd6 commit 2730461
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions tests/can.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ void check_validity(hal::hertz p_operating_frequency,
<< "Frequency '" << p_operating_frequency << "' and baud rate '"
<< p_target_baud_rate << "'\n";

auto test_subject = call_result.value();
// clang-tidy for some reason doesn't accept that `.value()` as "checked"
// usage of an optional.
auto test_subject = call_result.value(); // NOLINT

auto const bit_width = hal::bit_width(test_subject);

auto calculated_baud_rate =
p_operating_frequency /
(test_subject.clock_divider *
(test_subject.sync_segment + test_subject.propagation_delay +
test_subject.phase_segment1 + test_subject.phase_segment2));
auto const calculated_bit_width =
(test_subject.sync_segment + test_subject.propagation_delay +
test_subject.phase_segment1 + test_subject.phase_segment2);
auto const denominator =
static_cast<float>(test_subject.clock_divider * calculated_bit_width);
auto const calculated_baud_rate = p_operating_frequency / denominator;

expect(that % 8 <= bit_width && bit_width <= 25)
<< "Bit width is beyond the bounds of 8 and 25";
Expand Down
2 changes: 1 addition & 1 deletion tests/enum.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ boost::ut::suite<"enum_test"> enum_test = [] {
constexpr int expected1 = 1;
constexpr int expected2 = 20;

enum class test_enum
enum class test_enum : std::uint8_t
{
enum_value1 = expected1,
enum_value2 = expected2,
Expand Down

0 comments on commit 2730461

Please sign in to comment.