Skip to content
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

WIP: If the DBC sets a signal's min and max to 0, disable range checking #80

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion testing/can-messages/tests/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use can_messages::{
Amet, Bar, BarThree, CanError, Foo, LargerIntsWithOffsets, MultiplexTest,
MultiplexTestMultiplexorIndex, MultiplexTestMultiplexorM0, NegativeFactorTest,
MultiplexTestMultiplexorIndex, MultiplexTestMultiplexorM0, NegativeFactorTest, NoMinMax,
};

#[test]
Expand All @@ -20,6 +20,15 @@ fn check_range_value_valid() {
assert!(result.is_ok());
}

#[test]
fn check_min_max_zero_disables_range_check() {
let result = NoMinMax::new(10);
assert!(
result.is_ok(),
"This should be valid. The min and max are 0 in the DBC which disables range checking."
);
}

#[test]
fn check_min_max_values() {
// min/max copy-pasted from example.dbc:
Expand Down
2 changes: 2 additions & 0 deletions testing/dbc-examples/example.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ BS_:
BU_: Lorem Ipsum Dolor


BO_ 1345 NoMinMax: 1 Vector__XXX
SG_ NoMinMaxSignal : 0|8@1- (1,0) [0|0] "" Vector__XXX
BO_ 256 Foo: 4 Lorem
SG_ Voltage : 16|16@1+ (0.000976562,0) [0E-009|63.9990234375] "V" Vector__XXX
SG_ Current : 0|16@1- (0.0625,0) [-2048|2047.9375] "A" Vector__XXX
Expand Down
Loading