test(unit): add tests for utility, round_robin, and stat_trackers#5308
test(unit): add tests for utility, round_robin, and stat_trackers#5308dasepmoch wants to merge 1 commit into
Conversation
|
There was a problem hiding this comment.
This is awesome! Always glad to have more tests added!
Looks pretty good, but could you fix the sonar reported sonar issues as well as adjust the style of the comments mentioned below.
Also, please update the PR to use the correct template. You can find it at https://github.com/LizardByte/.github/blob/master/.github/pull_request_template.md?plain=1
|
|
||
| #include <vector> | ||
|
|
||
| // ========== Basic iteration tests ========== |
There was a problem hiding this comment.
Not really a fan of this style of comment. Can you change them to doxygen style doc blocks?
Or like
//
// Basic iteration tests
//
|
|
||
| TEST(StatTrackersFormatTests, OneDigitAfterDecimal) { | ||
| auto fmt = stat_trackers::one_digit_after_decimal(); | ||
| std::string result = (fmt % 3.14159).str(); |
There was a problem hiding this comment.
If you don't want to fix this sonar warning, you can use another number that isn't "pi".




Description
Add unit tests for three modules that currently have no test coverage:
src/utility.h— Hex conversion (util::hex,hex_vec,from_hex,from_hex_vec), string parsing (from_chars,from_view),Eithertype,FailGuard,buffer_t,append_struct, endian helpers, andlog_hex.src/round_robin.h— Round-robin iterator wrap-around, arithmetic operators, comparisons, edge cases (single element, multiple cycles), and arrow operator with structs.src/stat_trackers.h/.cpp— Format helpers (one_digit_after_decimal,two_digits_after_decimal),min_max_avg_trackercallback timing, min/max/avg calculation correctness, reset behavior, and double type support.These are pure-logic, header-only (or minimal .cpp) modules with zero external dependencies, making them ideal candidates for improving test coverage without needing GPU or platform-specific hardware.
Related Issues / Discussions
Type of Change
Checklist