-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PGN testing #411
PGN testing #411
Conversation
acmorrow
commented
Feb 4, 2025
- Run all tests in the workspace and do not fail fast
- Avoid need to reiterate PGN numbers in the PGN enum macro.
@@ -126,7 +126,7 @@ pub struct GnssSatsInView { | |||
} | |||
|
|||
macro_rules! define_pgns { | |||
( $(($pgndef:ident, $pgn:expr)),* ) => { | |||
( $($pgndef:ident),* ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't push more for this change in #408 because I wasn't completely sure there wasn't a reason it didn't work, but it sure seems to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, ok. Sounds good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the one thing to check is whether this NmeaMessageBody
type actually has any tests? If you want, I'll add one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -68,7 +68,7 @@ upload: cargo-ver | |||
cargo +esp espflash flash --package micro-rdk-server --monitor --partition-table micro-rdk-server/esp32/partitions.csv --baud 460800 -f 80mhz --bin micro-rdk-server-esp32 --target=xtensa-esp32-espidf -Zbuild-std=std,panic_abort | |||
|
|||
test: | |||
cargo test -p micro-rdk --lib --features native,ota | |||
cargo test --workspace --tests --no-fail-fast --features native,ota |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is --no-fail-fast
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents a failing test from stopping the execution of other tests. I'd much prefer to learn in one go all the tests I broke, rather than it stopping on the first failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, PTAL. I also fixed some new warnings that popped up with the expanded testing.
let nmea_message = NmeaMessage::try_from(data); | ||
assert!(nmea_message.is_ok()); | ||
|
||
let nmea_message = nmea_message.unwrap(); | ||
let message = match nmea_message.data { | ||
NmeaMessageBody::GnssSatsInView(val) => Some(val), | ||
_ => None, | ||
}; | ||
assert!(message.is_some()); | ||
let message = message.unwrap(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvaradarajan - New since last review, this now ensures that the NmeaMessage enum gets tested at least once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for adding this
); | ||
|
||
pub struct NmeaMessage { | ||
metadata: NmeaMessageMetadata, | ||
data: NmeaMessageBody, | ||
pub metadata: NmeaMessageMetadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for testing, let me know if you would prefer accessors, but I find them less interesting in a language where immutability is the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's just for testing, would pub(crate)
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, I think it would. I always forget that that is an option. Too accustomed to C++ having only public/private. If it works I'll make that change before push.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
let nmea_message = NmeaMessage::try_from(data); | ||
assert!(nmea_message.is_ok()); | ||
|
||
let nmea_message = nmea_message.unwrap(); | ||
let message = match nmea_message.data { | ||
NmeaMessageBody::GnssSatsInView(val) => Some(val), | ||
_ => None, | ||
}; | ||
assert!(message.is_some()); | ||
let message = message.unwrap(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for adding this
); | ||
|
||
pub struct NmeaMessage { | ||
metadata: NmeaMessageMetadata, | ||
data: NmeaMessageBody, | ||
pub metadata: NmeaMessageMetadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's just for testing, would pub(crate)
work?
@@ -504,6 +504,7 @@ impl LocalRobot { | |||
} | |||
|
|||
pub fn get_periodic_app_client_tasks(&mut self) -> Vec<Box<dyn PeriodicAppClientTask>> { | |||
#[allow(unused_mut)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, finally
@gvaradarajan - Oops. I thought I'd committed and pushed the change to |