diff --git a/CMakeLists.txt b/CMakeLists.txt index 227b970..d738c73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,8 @@ add_library(ds3231 INTERFACE) target_include_directories(ds3231 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_link_libraries(ds3231 INTERFACE libavr) +include(${LIBAVR_ROOT}/cmake/checks.cmake) + if(PROJECT_IS_TOP_LEVEL) add_subdirectory(example) enable_testing() diff --git a/libavr b/libavr index 99434fb..1412b71 160000 --- a/libavr +++ b/libavr @@ -1 +1 @@ -Subproject commit 99434fb29af18f219ba9d24ba22d4d068e5790bb +Subproject commit 1412b7173b5c343d225cced990473f5e6b510c32 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0e0d797..373b8b6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,5 @@ +libavr_format_test() + # The battery is a compile: a static_assert that fails is the failure. It is a # target rather than only a ctest so a plain build catches a regression too. add_library(consteval_tests OBJECT consteval.cpp) diff --git a/test/consteval.cpp b/test/consteval.cpp index 0541b51..64b1f9a 100644 --- a/test/consteval.cpp +++ b/test/consteval.cpp @@ -37,11 +37,11 @@ static_assert(bcd_round_trips()); static_assert(hours_from_reg(to_bcd(0)) == 0); // 24-hour midnight static_assert(hours_from_reg(to_bcd(13)) == 13); // 24-hour afternoon static_assert(hours_from_reg(to_bcd(23)) == 23); -static_assert(hours_from_reg(0x40 | to_bcd(12)) == 0); // 12 AM -static_assert(hours_from_reg(0x40 | 0x20 | to_bcd(12)) == 12); // 12 PM -static_assert(hours_from_reg(0x40 | to_bcd(1)) == 1); // 1 AM -static_assert(hours_from_reg(0x40 | 0x20 | to_bcd(1)) == 13); // 1 PM -static_assert(hours_from_reg(0x40 | 0x20 | to_bcd(11)) == 23); // 11 PM +static_assert(hours_from_reg(0x40 | to_bcd(12)) == 0); // 12 AM +static_assert(hours_from_reg(0x40 | 0x20 | to_bcd(12)) == 12); // 12 PM +static_assert(hours_from_reg(0x40 | to_bcd(1)) == 1); // 1 AM +static_assert(hours_from_reg(0x40 | 0x20 | to_bcd(1)) == 13); // 1 PM +static_assert(hours_from_reg(0x40 | 0x20 | to_bcd(11)) == 23); // 11 PM // Sakamoto's method, against dates a calendar can be checked against rather // than against this implementation run twice. Sunday is 1.