Skip to content

Commit

Permalink
Merge pull request #53 from mjhouse/add_roundtrip_tests
Browse files Browse the repository at this point in the history
Add roundtrip tests
  • Loading branch information
mjhouse authored Mar 12, 2024
2 parents 6bc293e + 968e39d commit 991bf97
Show file tree
Hide file tree
Showing 7 changed files with 735 additions and 445 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ StatusWord, and DataWord.
```rust
use mil_std_1553b::*;

let message = Message::new()
let message: Message = Message::new()
.with_command(CommandWord::new()
.with_address(Address::Value(12))
.with_subaddress(SubAddress::Value(5))
Expand All @@ -37,7 +37,7 @@ StatusWord, and DataWord.
.with_data(DataWord::new()).unwrap()
.with_data(DataWord::new()).unwrap();

assert_eq!(message.word_count(),3);
assert_eq!(message.length(),3);
```

### Parsing a message
Expand All @@ -50,7 +50,7 @@ how many data words will be parsed from the buffer.
```rust
use mil_std_1553b::*;

let message = Message::parse_command(&[
let message: Message = Message::read_command(&[
0b10000011,
0b00001100,
0b00100010,
Expand All @@ -59,15 +59,15 @@ how many data words will be parsed from the buffer.
])
.unwrap();

assert_eq!(message.word_count(),2);
assert_eq!(message.length(),2);
```

#### Status messages

```rust
use mil_std_1553b::*;

let message = Message::parse_status(&[
let message: Message = Message::read_status(&[
0b10000011,
0b00001100,
0b01000010,
Expand All @@ -76,7 +76,7 @@ how many data words will be parsed from the buffer.
])
.unwrap();

assert_eq!(message.word_count(), 2);
assert_eq!(message.length(), 2);
```

### Parsing a word
Expand Down Expand Up @@ -107,16 +107,16 @@ from strings.
- [x] Words have parsing tests
- [x] Words have conversion tests
- [x] Documentation exists for words
- [ ] Messages implemented
- [x] Messages implemented
- [x] Message struct is created
- [x] Messages can be constructed from words
- [x] Messages can be parsed from binary
- [x] Messages have parsing tests
- [ ] Messages have conversion tests
- [x] Messages have conversion tests
- [x] Documentation exists for messages
- [ ] Integration tests implemented
- [ ] Round-trip tests (binary -> struct -> binary) exist for messages
- [ ] Round-trip tests (binary -> struct -> binary) exist for words
- [x] Round-trip tests (binary -> struct -> binary) exist for messages
- [x] Round-trip tests (binary -> struct -> binary) exist for words
- [ ] Configuration tests (JSON) exist for words
- [ ] Configuration tests (JSON) exist for messages

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub use crate::message::{Message, MessageDirection, MessageSide, MessageType, Pa

pub use crate::errors::{Error, MessageError, Result, SubsystemError, SystemError, TerminalError};

pub use crate::word::{CommandWord, DataWord, StatusWord, Word, WordType};
pub use crate::word::{CommandWord, DataWord, Header, StatusWord, Word, WordType};

pub use crate::flags::{
Address, BroadcastReceived, DynamicBusAcceptance, Instrumentation, ModeCode, Reserved,
Expand Down
Loading

0 comments on commit 991bf97

Please sign in to comment.