From e146804ef6bbfaff5ce50afb2d90970b95659966 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Fri, 2 Aug 2024 16:15:29 -0700 Subject: [PATCH 1/3] add a message and signal where min and max are both 0 --- testing/dbc-examples/example.dbc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing/dbc-examples/example.dbc b/testing/dbc-examples/example.dbc index 1c90f45..023c383 100644 --- a/testing/dbc-examples/example.dbc +++ b/testing/dbc-examples/example.dbc @@ -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 From ee7bb0ed9e2e12de464fe731f55051e48019e6c5 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Fri, 2 Aug 2024 16:23:04 -0700 Subject: [PATCH 2/3] add failing test --- testing/can-messages/tests/all.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing/can-messages/tests/all.rs b/testing/can-messages/tests/all.rs index 2a3d2ab..7e0b671 100644 --- a/testing/can-messages/tests/all.rs +++ b/testing/can-messages/tests/all.rs @@ -3,6 +3,7 @@ use can_messages::{ Amet, Bar, BarThree, CanError, Foo, LargerIntsWithOffsets, MultiplexTest, MultiplexTestMultiplexorIndex, MultiplexTestMultiplexorM0, NegativeFactorTest, + NoMinMax }; #[test] @@ -20,6 +21,12 @@ 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: From edf5703a5ad04e398b821fb81aed6bc732310304 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Fri, 2 Aug 2024 16:29:33 -0700 Subject: [PATCH 3/3] reformat --- testing/can-messages/tests/all.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/can-messages/tests/all.rs b/testing/can-messages/tests/all.rs index 7e0b671..db5798e 100644 --- a/testing/can-messages/tests/all.rs +++ b/testing/can-messages/tests/all.rs @@ -2,8 +2,7 @@ use can_messages::{ Amet, Bar, BarThree, CanError, Foo, LargerIntsWithOffsets, MultiplexTest, - MultiplexTestMultiplexorIndex, MultiplexTestMultiplexorM0, NegativeFactorTest, - NoMinMax + MultiplexTestMultiplexorIndex, MultiplexTestMultiplexorM0, NegativeFactorTest, NoMinMax, }; #[test] @@ -24,7 +23,10 @@ fn check_range_value_valid() { #[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."); + assert!( + result.is_ok(), + "This should be valid. The min and max are 0 in the DBC which disables range checking." + ); } #[test]