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

Unit testing and refactoring of object pool loading #27

Merged
merged 31 commits into from
Nov 18, 2023
Merged
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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ description = "A Free ISO-11783 and J1939 CAN Stack"
keywords = ["agriculture", "can", "canbus", "isobus", "j1939", "agritech", "smart-farming", "iso11783"]

[dependencies]
bitvec = "1.0.1"
rand = "0.8.5"
socketcan = { version = "2.0.0", optional = true }
strum_macros = "0.25.2"

[features]
default = []
Expand Down
Binary file added resources/test/AgIsoStack-rs-test-pool.iop
Binary file not shown.
2 changes: 1 addition & 1 deletion src/driver/can_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ mod tests {
Address(0x0F),
Priority::Six,
);
assert!(matches!(encode_result, Err(_)));
assert!(matches!(encode_result.is_err(), true));

let error_contents: EncodingError = encode_result.unwrap_err();
assert_eq!(error_contents.priority, Priority::Six);
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

pub mod driver;
pub mod network_management;
pub mod object_pool;
8 changes: 7 additions & 1 deletion src/network_management/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum NameField {
SelfConfigurableAddress(bool),
}

#[derive(Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct NAME {
raw_name: u64,
}
Expand Down Expand Up @@ -292,6 +292,12 @@ impl From<NAME> for u64 {
}
}

impl From<NAME> for [u8; 8] {
fn from(name: NAME) -> Self {
name.raw_name.to_le_bytes()
}
}

#[derive(Default)]
pub struct NameBuilder {
self_configurable_address: bool,
Expand Down
339 changes: 339 additions & 0 deletions src/object_pool/colour.rs

Large diffs are not rendered by default.

Loading
Loading