Browse Source

Update documentation comments and noop.bin test file. Build release by default

tags/v0.3.0^0 v0.3.0
Alex Williams 8 months ago
parent
commit
c57a05aa13
Signed by: aw GPG Key ID: 19EE4AAA361A7E2C
4 changed files with 9 additions and 9 deletions
  1. +3
    -3
      Makefile
  2. +5
    -5
      README.md
  3. +1
    -1
      src/lib.rs
  4. BIN
      testdata/noop.bin

+ 3
- 3
Makefile View File

@ -7,7 +7,7 @@ all: build doc tests
tests: tests-cargo tests-bad tests-good
build:
cargo build
cargo build --release
doc:
cargo doc
@ -17,10 +17,10 @@ tests-cargo:
tests-bad: build
for x in $$(ls testdata/bad-*.bin) ; do \
./target/debug/validate "$$x" 2>/dev/null || echo -n ; \
./target/release/validate "$$x" 2>/dev/null || echo -n ; \
done
tests-good: build
for x in $$(ls testdata/good-*.bin) ; do \
./target/debug/validate "$$x" >/dev/null ; \
./target/release/validate "$$x" >/dev/null ; \
done

+ 5
- 5
README.md View File

@ -28,7 +28,7 @@ Once the `cargo` and `rustc` commands are available, run the following commands:
Alternatively, just type `make`.
You should then have the binary in `target/debug/validate`, as well as HTML docs in `target/doc/boawp_validator`.
You should then have the binary in `target/release/validate`, as well as HTML docs in `target/doc/boawp_validator`.
# Usage
@ -39,13 +39,13 @@ In most cases, calling the binary directly against files generated by your imple
The binary only takes one argument: the `filename` to be decoded.
```bash
target/debug/validate testdata/noop.bin
Decoded: (Init { name: 'B', version: '0', status: 'A', lf: '\n' }, Fixed { null: 0, cmd: '\n', hlength: 0, blength: 0 }, Headers { headers: [] }, Body { body: [] })
target/release/validate testdata/noop.bin
Decoded: (Init { name: 'B', version: '0', status: 'A', lf: '\n' }, Fixed { null: 0, cmd: '\n', hlength: 0, blength: 0, command: "NOOP" }, Headers { headers: [] }, Body { body: [] })
```
If decoding is successful, the exit code is `0` and the `Decoded...` result will appear in `STDOUT`.
If decoding fails, the exist code is `-1` and the `Error...` result will appear in `STDERR`.
If decoding fails, the exit code is `-1` and the `Error...` result will appear in `STDERR`.
## BOAWP library usage
@ -65,7 +65,7 @@ let mut reader = BufReader::new(&data[..]);
let validated = validate(&mut reader).unwrap();
assert_eq!(validated.0, Init { name: 'B', version: '0', status: 'A', lf: '\n' });
assert_eq!(validated.1, Fixed { null: 0, cmd: '\n', hlength: 0, blength: 0 });
assert_eq!(validated.1, Fixed { null: 0, cmd: '\n', hlength: 0, blength: 0, command: "NOOP".to_string() });
assert_eq!(validated.2, Headers { headers: vec![] });
assert_eq!(validated.3, Body { body: vec![] });
```


+ 1
- 1
src/lib.rs View File

@ -13,7 +13,7 @@ Usage is intended through the cli binary `validate`.
```bash
validate noop.bin
Decoded: (Init { name: 'B', version: '0', status: 'A', lf: '\n' }, Fixed { null: 0, cmd: '\n', hlength: 0, blength: 0 }, Headers { headers: [] }, Body { body: [] })
Decoded: (Init { name: 'B', version: '0', status: 'A', lf: '\n' }, Fixed { null: 0, cmd: '\n', hlength: 0, blength: 0, command: "NOOP" }, Headers { headers: [] }, Body { body: [] })
```
A correctly validated file will output the deserialized data to `STDOUT` and the


BIN
testdata/noop.bin View File


Loading…
Cancel
Save