From f60b83ff9cf8519902d88d32b5cb85afc4e235c2 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Sat, 19 Jul 2025 15:49:35 +0100 Subject: [PATCH] keirstarmers five tests --- src/sync_logic.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 1982017..0b33c36 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -140,8 +140,7 @@ impl LtcState { mod tests { use super::*; use chrono::{Local, Utc}; - - #[test] + fn get_test_frame(status: &str, h: u32, m: u32, s: u32) -> LtcFrame { LtcFrame { status: status.to_string(), @@ -161,6 +160,15 @@ mod tests { assert!(frame.matches_system_time()); } + #[test] + fn test_ltc_frame_does_not_match_system_time() { + let now = Local::now(); + // Create a time that is one hour ahead, wrapping around 23:00 + let different_hour = (now.hour() + 1) % 24; + let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); + assert!(!frame.matches_system_time()); + } + #[test] fn test_ltc_state_update_lock() { let mut state = LtcState::new();