Skip to content
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
1 change: 1 addition & 0 deletions rust/sbp/src/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct CommonJson<'a> {
crc: u16,
length: u8,
msg_type: u16,
msg_name: &'a str,
payload: &'a str,
preamble: u8,
sender: u16,
Expand Down
1 change: 1 addition & 0 deletions rust/sbp/src/json/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ fn get_common_fields<'a, M: SbpMessage>(
Ok(CommonJson {
preamble: PREAMBLE,
sender: msg.sender_id().unwrap_or(0),
msg_name: msg.message_name(),
msg_type: msg.message_type(),
length: size as u8,
payload: payload_buf,
Expand Down
10 changes: 3 additions & 7 deletions rust/sbp2json/tests/test_round_trips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ fn test_stop_on_error() {
fn test_continue_on_error() {
let root = find_project_root().unwrap();
let root = root.as_path();
let input_path = root.join(format!("test_data/{}", "short.sbp"));
let input_path = root.join(format!("test_data/{}", "short.sbp.json"));

let source = File::open(input_path).unwrap();
let mut sink = Cursor::new(vec![]);
let mut source = File::open(input_path).unwrap();

let _ = converters::sbp2json(source, &mut sink, CompactFormatter {}, false, false);

sink.set_position(0);
assert_eq!(sbp::iter_messages(&mut sink).count(), 355);
assert_eq!(sbp::iter_messages(&mut source).count(), 355);
}

#[test]
Expand Down
10,000 changes: 5,000 additions & 5,000 deletions test_data/roundtrip.json

Large diffs are not rendered by default.

2,000 changes: 1,000 additions & 1,000 deletions test_data/roundtrip.json2json.output

Large diffs are not rendered by default.

10,000 changes: 5,000 additions & 5,000 deletions test_data/roundtrip_float_compat.json

Large diffs are not rendered by default.

2,382 changes: 2,382 additions & 0 deletions test_data/short.sbp.json

Large diffs are not rendered by default.