Skip to content

Commit 20fbadc

Browse files
fix: resolve clang-tidy issues in RTTEstimator and Reliability tests
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5054bd4 commit 20fbadc

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

tests/tests/nuclearnet/RTTEstimator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#include <catch2/catch_test_macros.hpp>
2626
#include <chrono>
27-
#include <thread>
2827

2928
using NUClear::network::RTTEstimator;
3029
using namespace std::chrono_literals;

tests/tests/nuclearnet/Reliability.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ SCENARIO("Reliability stops retransmitting ACKed fragments", "[nuclearnet][relia
8080
rel.track_packet(target, 1, 2, 0x1234, 0x01, payload.data(), payload.size(), t);
8181

8282
// ACK fragment 0 (bitset: bit 0 set)
83-
uint8_t ack_bits = 0x01; // fragment 0 received
83+
const uint8_t ack_bits = 0x01; // fragment 0 received
8484
rel.process_ack(target, 1, 2, &ack_bits, 1, t + std::chrono::milliseconds(50));
8585

8686
// Inject short RTT and check past min_rto
@@ -102,7 +102,7 @@ SCENARIO("Reliability removes tracked packet when all fragments ACKed", "[nuclea
102102
rel.track_packet(target, 5, 1, 0x5678, 0x01, payload.data(), payload.size(), t);
103103

104104
// ACK all fragments
105-
uint8_t ack_bits = 0x01; // fragment 0 received (only 1 fragment total)
105+
const uint8_t ack_bits = 0x01; // fragment 0 received (only 1 fragment total)
106106
rel.process_ack(target, 5, 1, &ack_bits, 1, t + std::chrono::milliseconds(50));
107107

108108
// Inject short RTT and check well past min_rto — nothing to retransmit
@@ -143,14 +143,14 @@ SCENARIO("Reliability retransmits indefinitely until peer is removed", "[nuclear
143143
}
144144

145145
SCENARIO("Reliability build_ack_packet encodes bitset correctly", "[nuclearnet][reliability]") {
146-
std::vector<bool> received = {true, false, true, true, false, false, false, true}; // 0b10001101 = 0x8D
146+
const std::vector<bool> received = {true, false, true, true, false, false, false, true}; // 0b10001101 = 0x8D
147147
auto ack = Reliability::build_ack_packet(42, 8, received);
148148

149149
// The packet should contain a header + 1 byte of bitset
150150
// Verify the bitset byte
151-
REQUIRE(ack.size() > 0);
151+
REQUIRE_FALSE(ack.empty());
152152
// The last byte(s) should be the bitset
153-
uint8_t bitset_byte = ack.back();
153+
const uint8_t bitset_byte = ack.back();
154154
REQUIRE(bitset_byte == 0x8D);
155155
}
156156

0 commit comments

Comments
 (0)