mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 00:57:38 +00:00
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:
@@ -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();
|
Reference in New Issue
Block a user