SymField rewrite (#1444)

* First WIP symfield

* Cleanup widget code

* Rebase and format

* Fix 'to_integer' bug, fix siggen UI.

* to_string_hex fix, unit tests for string code

* Pass instance in callback

* Fix on_change callbacks

* Fix keyfob (not active)

* to_byte_array, coaster tx cleanup

* Add to_byte_array tests

* Changes in ui_numbers

* Fix ui_encoders

* Format

* Fix modemsetup view's symfields

* Remove header

* Format
This commit is contained in:
Kyle Reed 2023-09-12 12:38:19 -07:00 committed by GitHub
parent 70e0f2913f
commit af424aa5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 607 additions and 371 deletions

View file

@ -71,4 +71,22 @@ TEST_CASE("ms_duration should return duration.") {
TEST_CASE("ms_duration not fault when passed zero.") {
CHECK_EQ(ms_duration(0, 0, 0), 0);
}
TEST_CASE("to_byte_array returns correct size and values.") {
auto arr1 = to_byte_array<uint8_t>(0xAB);
REQUIRE_EQ(std::size(arr1), 1);
CHECK_EQ(arr1[0], 0xAB);
auto arr2 = to_byte_array<uint16_t>(0xABCD);
REQUIRE_EQ(std::size(arr2), 2);
CHECK_EQ(arr2[0], 0xAB);
CHECK_EQ(arr2[1], 0xCD);
auto arr4 = to_byte_array<uint32_t>(0xABCD1234);
REQUIRE_EQ(std::size(arr4), 4);
CHECK_EQ(arr4[0], 0xAB);
CHECK_EQ(arr4[1], 0xCD);
CHECK_EQ(arr4[2], 0x12);
CHECK_EQ(arr4[3], 0x34);
}