From 956b719e127f6a2c9d6446202bd67913e11e8558 Mon Sep 17 00:00:00 2001 From: Will Greenberg Date: Wed, 24 Jun 2026 16:17:31 -0700 Subject: [PATCH] hardcode build_log_mask_request() unit test input Instead of having to change the expected value every time we add a log type to our list, let's just hardcode it to a known value. --- lib/src/diag/diaglog/mod.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/src/diag/diaglog/mod.rs b/lib/src/diag/diaglog/mod.rs index 4d57b4a..d4ff8ed 100644 --- a/lib/src/diag/diaglog/mod.rs +++ b/lib/src/diag/diaglog/mod.rs @@ -129,7 +129,7 @@ impl Timestamp { #[cfg(test)] pub(crate) mod test { use super::*; - use crate::{diag::*, hdlc}; + use crate::{diag::*, hdlc, log_codes}; #[test] fn test_logs() { @@ -235,7 +235,17 @@ pub(crate) mod test { let req = build_log_mask_request( log_type, bitsize, - &crate::diag_device::LOG_CODES_FOR_RAW_PACKET_LOGGING, + &[ + log_codes::LOG_GSM_RR_SIGNALING_MESSAGE_C, + log_codes::WCDMA_SIGNALLING_MESSAGE, + log_codes::LOG_LTE_RRC_OTA_MSG_LOG_C, + log_codes::LOG_NR_RRC_OTA_MSG_LOG_C, + log_codes::LOG_UMTS_NAS_OTA_MESSAGE_LOG_PACKET_C, + log_codes::LOG_LTE_NAS_ESM_OTA_IN_MSG_LOG_C, + log_codes::LOG_LTE_NAS_ESM_OTA_OUT_MSG_LOG_C, + log_codes::LOG_LTE_NAS_EMM_OTA_IN_MSG_LOG_C, + log_codes::LOG_LTE_NAS_EMM_OTA_OUT_MSG_LOG_C, + ], ); assert_eq!( req, @@ -243,11 +253,10 @@ pub(crate) mod test { log_type, log_mask_bitsize: bitsize, log_mask: vec![ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x30, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x80, 0x1, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 12, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 ], }) );