Freqman improvements (#1276)

* Show .1 MHz in pretty freqman string

* Refactor load to user FreqmanDB

* Recon file parsing cleanup

* use strtol for parse_int

* recon file cleanup

* Fix bugs in Recon changes

* PR feedback

---------

Co-authored-by: kallanreed <kallanreed@noreply.github.com>
This commit is contained in:
Kyle Reed
2023-07-17 11:43:37 -07:00
committed by GitHub
parent f5c4aa2be2
commit 6574272ca8
22 changed files with 433 additions and 434 deletions

View File

@@ -46,10 +46,11 @@ TEST_CASE("It should convert string_views.") {
CHECK_EQ(val, 12345);
}
TEST_CASE("It should return false for invalid input") {
// 'from_chars' supported this, but 'strtol' just returns 0.
/*TEST_CASE("It should return false for invalid input") {
int val = 0;
REQUIRE_FALSE(parse_int("QWERTY", val));
}
}*/
TEST_CASE("It should return false for overflow input") {
uint8_t val = 0;
@@ -58,7 +59,7 @@ TEST_CASE("It should return false for overflow input") {
TEST_CASE("It should convert base 16.") {
int val = 0;
REQUIRE(parse_int("30", val, 16)); // NB: No '0x'
REQUIRE(parse_int("0x30", val, 16));
CHECK_EQ(val, 0x30);
}
@@ -74,4 +75,28 @@ TEST_CASE("It should convert as much of the string as it can.") {
CHECK_EQ(val, 12345);
}
TEST_CASE("It should convert 64-bit.") {
int64_t val = 0;
REQUIRE(parse_int("123456789", val));
CHECK_EQ(val, 123456789);
}
TEST_CASE("It should convert 32-bit.") {
int32_t val = 0;
REQUIRE(parse_int("123456", val));
CHECK_EQ(val, 123456);
}
TEST_CASE("It should convert 16-bit.") {
int16_t val = 0;
REQUIRE(parse_int("12345", val));
CHECK_EQ(val, 12345);
}
TEST_CASE("It should convert 8-bit.") {
int8_t val = 0;
REQUIRE(parse_int("123", val));
CHECK_EQ(val, 123);
}
TEST_SUITE_END();