From bb2ea909b63174d8d3fb79f1eeb331aa60b97b84 Mon Sep 17 00:00:00 2001 From: notoriaga Date: Fri, 27 Jan 2023 13:20:46 -0800 Subject: [PATCH] rust: use &[u8] for tests --- .../resources/rust/test/sbp_tests_template.rs | 2 +- generator/sbpg/targets/test_rust.py | 6 +- ..._bootload_msg_bootloader_handshake_resp.rs | 36 +- .../auto_check_sbp_logging_msg_log.rs | 54 ++- .../auto_check_sbp_logging_msg_print_dep.rs | 360 ++++++++++++------ ...bp_navigation_msg_reference_frame_param.rs | Bin 19784 -> 21524 bytes ...k_sbp_piksi_msg_network_bandwidth_usage.rs | Bin 26592 -> 27900 bytes .../auto_check_sbp_piksi_msg_thread_state.rs | Bin 73865 -> 77915 bytes ...ettings_msg_settings_read_by_index_resp.rs | Bin 33790 -> 40588 bytes .../auto_check_sbp_system_msg_dgnss_status.rs | 30 +- 10 files changed, 307 insertions(+), 181 deletions(-) diff --git a/generator/sbpg/targets/resources/rust/test/sbp_tests_template.rs b/generator/sbpg/targets/resources/rust/test/sbp_tests_template.rs index 28e23b7dbd..e9f1c09580 100644 --- a/generator/sbpg/targets/resources/rust/test/sbp_tests_template.rs +++ b/generator/sbpg/targets/resources/rust/test/sbp_tests_template.rs @@ -15,7 +15,7 @@ use crate::*; ((*- macro compare_value(prefix, value) *)) ((*- if value is string_type *)) -assert_eq!(msg.(((prefix|snake_case))).to_string(), (((value|str_escape))), "incorrect value for msg.(((prefix|snake_case))), expected string '{}', is '{}'", (((value|str_escape))), msg.(((prefix|snake_case)))); +assert_eq!(msg.(((prefix|snake_case))).as_bytes(), (((value|bytes_escape))), "incorrect value for msg.(((prefix|snake_case))), expected string '{:?}', is '{:?}'", (((value|bytes_escape))), msg.(((prefix|snake_case))).as_bytes()); ((*- elif value is array_type *)) ((*- for ff in value *))((( compare_value( (((prefix|snake_case))) + '[' + (((loop.index0|to_str))) + ']', (((ff))) ) )))((*- endfor *)) ((*- elif value is dict_type *)) diff --git a/generator/sbpg/targets/test_rust.py b/generator/sbpg/targets/test_rust.py index 16ee2d03ce..9c6f897b8d 100644 --- a/generator/sbpg/targets/test_rust.py +++ b/generator/sbpg/targets/test_rust.py @@ -22,14 +22,14 @@ TEST_TEMPLATE_NAME = "rust/test/sbp_tests_template.rs" TEST_MAIN_TEMPLATE_NAME = "rust/test/sbp_tests_main_template.rs" -def str_escape(value): - return "\"{}\"".format(value) +def bytes_escape(value): + return "&{}".format(list(bytes(value, "ascii"))) def mod_name(value): return value.split('.')[1] JENV.filters['to_str'] = to_str -JENV.filters['str_escape'] = str_escape +JENV.filters['bytes_escape'] = bytes_escape JENV.filters['sorted'] = sorted JENV.filters['mod_name'] = mod_name JENV.filters['lower_acronyms'] = lower_acronyms diff --git a/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs b/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs index b45b144133..67fd77df42 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs @@ -51,13 +51,11 @@ fn test_auto_check_sbp_bootload_msg_bootloader_handshake_resp() { msg.flags ); assert_eq!( - msg.version.to_string(), - "v1.2 -", - "incorrect value for msg.version, expected string '{}', is '{}'", - "v1.2 -", - msg.version + msg.version.as_bytes(), + &[118, 49, 46, 50, 10], + "incorrect value for msg.version, expected string '{:?}', is '{:?}'", + &[118, 49, 46, 50, 10], + msg.version.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeResp"), @@ -166,13 +164,11 @@ fn test_json2sbp_auto_check_sbp_bootload_msg_bootloader_handshake_resp() { msg.flags ); assert_eq!( - msg.version.to_string(), - "v1.2 -", - "incorrect value for msg.version, expected string '{}', is '{}'", - "v1.2 -", - msg.version + msg.version.as_bytes(), + &[118, 49, 46, 50, 10], + "incorrect value for msg.version, expected string '{:?}', is '{:?}'", + &[118, 49, 46, 50, 10], + msg.version.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeResp"), @@ -297,13 +293,11 @@ fn test_sbp2json_auto_check_sbp_bootload_msg_bootloader_handshake_resp() { msg.flags ); assert_eq!( - msg.version.to_string(), - "v1.2 -", - "incorrect value for msg.version, expected string '{}', is '{}'", - "v1.2 -", - msg.version + msg.version.as_bytes(), + &[118, 49, 46, 50, 10], + "incorrect value for msg.version, expected string '{:?}', is '{:?}'", + &[118, 49, 46, 50, 10], + msg.version.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeResp"), diff --git a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs index 307cba5f1e..3de796ebb0 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs @@ -53,11 +53,19 @@ fn test_auto_check_sbp_logging_msg_log() { msg.level ); assert_eq!( - msg.text.to_string(), - "Filtered all obs from 2314 at tow 83.539019", - "incorrect value for msg.text, expected string '{}', is '{}'", - "Filtered all obs from 2314 at tow 83.539019", - msg.text + msg.text.as_bytes(), + &[ + 70, 105, 108, 116, 101, 114, 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, + 32, 102, 114, 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, 119, + 32, 56, 51, 46, 53, 51, 57, 48, 49, 57 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 70, 105, 108, 116, 101, 114, 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, + 32, 102, 114, 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, 119, + 32, 56, 51, 46, 53, 51, 57, 48, 49, 57 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgLog"), @@ -117,11 +125,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_log() { msg.level ); assert_eq!( - msg.text.to_string(), - "Filtered all obs from 2314 at tow 83.539019", - "incorrect value for msg.text, expected string '{}', is '{}'", - "Filtered all obs from 2314 at tow 83.539019", - msg.text + msg.text.as_bytes(), + &[ + 70, 105, 108, 116, 101, 114, 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, + 32, 102, 114, 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, 119, + 32, 56, 51, 46, 53, 51, 57, 48, 49, 57 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 70, 105, 108, 116, 101, 114, 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, + 32, 102, 114, 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, 119, + 32, 56, 51, 46, 53, 51, 57, 48, 49, 57 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgLog"), @@ -190,11 +206,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_log() { msg.level ); assert_eq!( - msg.text.to_string(), - "Filtered all obs from 2314 at tow 83.539019", - "incorrect value for msg.text, expected string '{}', is '{}'", - "Filtered all obs from 2314 at tow 83.539019", - msg.text + msg.text.as_bytes(), + &[ + 70, 105, 108, 116, 101, 114, 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, + 32, 102, 114, 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, 119, + 32, 56, 51, 46, 53, 51, 57, 48, 49, 57 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 70, 105, 108, 116, 101, 114, 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, + 32, 102, 114, 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, 119, + 32, 56, 51, 46, 53, 51, 57, 48, 49, 57 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgLog"), diff --git a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs index 3cd1d2021a..fb6505d282 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs @@ -48,13 +48,19 @@ fn test_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, 122, 44, + 32, 50, 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, 122, 44, + 32, 50, 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -90,13 +96,19 @@ fn test_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, 44, 32, + 50, 49, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, 44, 32, + 50, 49, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -132,13 +144,19 @@ fn test_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: Disabling channel 0 (PRN 11) -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: Disabling channel 0 (PRN 11) -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, + 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, + 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -174,13 +192,19 @@ fn test_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, 32, 50, + 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, 32, 50, + 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -216,13 +240,19 @@ fn test_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, 44, 32, + 50, 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, 44, 32, + 50, 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -258,13 +288,19 @@ fn test_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: Disabling channel 1 (PRN 15) -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: Disabling channel 1 (PRN 15) -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, + 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, + 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -319,13 +355,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, 122, 44, + 32, 50, 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, 122, 44, + 32, 50, 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -366,13 +408,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, 44, 32, + 50, 49, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, 44, 32, + 50, 49, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -413,13 +461,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: Disabling channel 0 (PRN 11) -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: Disabling channel 0 (PRN 11) -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, + 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, + 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -460,13 +514,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, 32, 50, + 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, 32, 50, + 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -507,13 +567,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, 44, 32, + 50, 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, 44, 32, + 50, 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -554,13 +620,19 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: Disabling channel 1 (PRN 15) -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: Disabling channel 1 (PRN 15) -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, + 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, + 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -624,13 +696,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, 122, 44, + 32, 50, 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, 122, 44, + 32, 50, 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -685,13 +763,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, 44, 32, + 50, 49, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, + 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, 44, 32, + 50, 49, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -746,13 +830,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: Disabling channel 0 (PRN 11) -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: Disabling channel 0 (PRN 11) -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, + 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, + 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -807,13 +897,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, 32, 50, + 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, 32, 50, + 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -868,13 +964,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, 44, 32, + 50, 48, 32, 83, 78, 82, 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, + 111, 117, 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, 44, 32, + 50, 48, 32, 83, 78, 82, 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), @@ -929,13 +1031,19 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { "incorrect sender id, expected 0x2222, is {sender_id}" ); assert_eq!( - msg.text.to_string(), - "INFO: Disabling channel 1 (PRN 15) -", - "incorrect value for msg.text, expected string '{}', is '{}'", - "INFO: Disabling channel 1 (PRN 15) -", - msg.text + msg.text.as_bytes(), + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, + 10 + ], + "incorrect value for msg.text, expected string '{:?}', is '{:?}'", + &[ + 73, 78, 70, 79, 58, 32, 68, 105, 115, 97, 98, 108, 105, 110, 103, 32, 99, + 104, 97, 110, 110, 101, 108, 32, 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, + 10 + ], + msg.text.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgPrintDep"), diff --git a/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs b/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs index e2b6a1335dd307480245d505f9a4cb3f7e95e288..c5e5a0899c9d3197af119ac2ba38f53769fa827e 100644 GIT binary patch delta 931 zcmX>xi*d>d#tn0YI1-EFlPXJ6izhGil3-Gcp6tjWI{5&XX9xh6NTuufv( zoxDJV11!wTA_-E$7(1DfUwiTcHz{5#`&xA!h0J0F^=d2oNk)<+8S+p^nkP>W<^~PT z&4zk*%sAb2%2XHXCJ|IOiJ`cOWipqy7+!Y~H0Yv$6mJQ#!zKsncubye^lI~6i5wA} g4jc_Mj6mBw-{`XNXn>()Ay{(7mCBw?Ugt9l0Q5>BBLDyZ delta 738 zcmbQTg7L&G#tn0YxJ&Zmi%W_!^U^gmCo}SkE2QP;GvEW0A99LMZV=YztX0=h$ShV+ zub!M3D5#j6CPJ??V+qi1&&}pi eVWJpz6Lk4d_OZJ8W#JL!%Dz@z zM=%k=r_*G6LGH;r0xdW9hvhJ%`zn@IYw`zXZiI#WlO3XP z_zbF+F?RAt5hZRtgfD1Mv&AQrV3AvOGYsrRNRr zY>FoFC~Yn@{KSlDm?4r`3`&y|1+W>0rszYY(q=_L4AW9eGSHlsD4;gER#a6H&3PCK zbtZ4LQk*O(?mGFsHP_}f);G}|nv;+0Oa`z+)h6pp2~J)RB7*LFOvM5zN}C;}F&tc+ zS%SsEbLBA{jG<6x@l%*u-yv}k6J#uHjHpmRKB@Qp?hux!8# Rbx%G=*yCnWDy~i;R;fsV$sTq7+R8H4<(+5 zReNapQmsE0pAbll`H~O>N)J7R;8QOxyn7un`tH4a-gS@Pl1=FO{`Nb+^ZT9e>`X11 zzOR|yHP+Uii4C2-dG%Zjp6#>mXgvk_A6+$)_cW}8du)NOxO#XvGMEMZLK6S*doB3JpAx8sg zYrJSeJ&Y<eyhO^_1( zqTm9nwI0^K+F)6%RlW#bpqMfs&rG^u z*b+f{>1a6xSiOFPJRUxY&156QrDgy`tjri>#JtLVB66Lfb5;etX{cInQ^#FPiSp zn%?f-Y)%aMhZFJeU_bO;wbnOBgWbn;BlEC z-l)--xwlRPgs%WFZ?0yrtyQd+L+y34%U=o?GlOFB7_u?8X z#zeFRGiL6ftJZqSnD>-t4M6{bK@cs6&~&ne{OgK3n};M@(coaPzfTK>t{Y&Ch-f)6 zl|D>5slUx4`P$G#WF0OEfNWVAIYi5C2#NSaeO*y$Zpez2KtyW*SsY+|YFS?vb$8op z#q1%gR>BZ1htZiH`9L9?RRRz#2SCi+nQA&fmT21DE?Fr*orniRkxJtJlQ&VzNg0+m zJAt%2LIamv)vh6Sn6wE84TSDiJ$-Z}0-MATASqJr2+{J%u^n~5s&!d+1cA^#n!6E^ zTp>wP0ue0-vNHNCIYN@81Rz=tD0UC{+X~E*6SR+8=;?cxB}*IJLoI}A6I7xg1*7zZ zXt^)Fj946O1l$vQX?oHp(U4s$X^7UK=`W`7sTb0!ko_tlh?YZG0~ODblm3}LE7?I7 ztt25@PBN+}`{5x*66<9>lBngRaus*&~5Z?&t4mEPz=0bZ^ghsRsb(cFBz7IyA< zCpHF>Eu}$3%MF%aia&Jl6U!K5+NFUa=~D6#t-&ibRGyA5JgROQ)5-EUoy`wQql^_^ zi=#x6rnH7=xwT4FEv0fz$ak2inn>Orq-i~T29d`?F;z}Aq{@H diff --git a/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs b/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs index b68a63cf62be0d1a5a8db45a1c5dff71c42098fc..3f635a6e69d2814230dd34a7ecd20e989c43bd53 100644 GIT binary patch delta 2961 zcmey@&eXG)X+s7lM`Ce&Qe{bM@#I2I2`07Z$$|o+lMDD*CSPPW6;-e_*HJJuFaQyz zK*G>aN5Nq7L@qI~iue#a4h2iFxG7w)mL+2Hd@c^K0`5@n$&rZk=qMOl=qOkK zO*8?r&4BtqVwOO|4M3JM#!i0d;l*oZU#qU8kXfvtUTtMRxv@!dfZa5aOOaC#9!3Y1 zl{RmXS7n^MAnwxU^TKY-llcX<;0!{=4E@RaJRFnNss&-;F!^7c3$eb%uN}L?HvbVi z%Yw&2W&*%|L99|Hz6buq7t{sFIzmSS?0g?Bmmp;g-o8 z^aE2cK%t)~0!mk~xn>GtrO~U6M(sCXV zE+oxBtZoK}qpwpKK6jIr>4$$%~7 zQYZI>aZX-a@Obn5IAQj|lcVA8n*3Yn%4XZ59@fe4?D5riq-97V(jaLD;tbo(YYQ&m l3s=%IBoXc=%|M*)2B(Q@Rd~|`zHCZ_OYv#P?XKMBi2zeMN1gxx delta 1924 zcmeC#%k;0EX+s7lXGwm1aY<2TUi##Z!V+pqC8;^7xv3>ZmGMQ1DVg~U$@zI{ndzlP zi6xo&c~F%MlXn=YF)~a}WEY>jLDht_R$WISvsgjBdh$nANm7lFo}9qRzBy3LgK@J0 z|49~9_b4fqCKi>%r28Ojn7Ri&So$(H8nOR!dl!KVb;1ZPLAqayZJr88}sD*VOvn$AcN%fq{Pw` zU<{-(7#e^94%-Q7f!XWIIQi}5OAvegb&02Puc+vr_k{{gqP3|dptjC?2u;fAH)Q?*uI3nQI+XjZASx+cAVX>Hy7Pyt0 z1EQv*Sx02@!D1_sIuVxNOWrkj5?|{iU~ZJsngLbe@uO2QH+#A$>@3DEX8o1;44q9qAJ$q9?SgtWkI+%)+=nqP@bMp!H*QYYN* LNt0(V)p7v<3EYXW diff --git a/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs b/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs index 8054c60118..542d4d3f57 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs @@ -61,11 +61,11 @@ fn test_auto_check_sbp_system_msg_dgnss_status() { msg.num_signals ); assert_eq!( - msg.source.to_string(), - "Skylark", - "incorrect value for msg.source, expected string '{}', is '{}'", - "Skylark", - msg.source + msg.source.as_bytes(), + &[83, 107, 121, 108, 97, 114, 107], + "incorrect value for msg.source, expected string '{:?}', is '{:?}'", + &[83, 107, 121, 108, 97, 114, 107], + msg.source.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgDgnssStatus"), @@ -135,11 +135,11 @@ fn test_json2sbp_auto_check_sbp_system_msg_dgnss_status() { msg.num_signals ); assert_eq!( - msg.source.to_string(), - "Skylark", - "incorrect value for msg.source, expected string '{}', is '{}'", - "Skylark", - msg.source + msg.source.as_bytes(), + &[83, 107, 121, 108, 97, 114, 107], + "incorrect value for msg.source, expected string '{:?}', is '{:?}'", + &[83, 107, 121, 108, 97, 114, 107], + msg.source.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgDgnssStatus"), @@ -216,11 +216,11 @@ fn test_sbp2json_auto_check_sbp_system_msg_dgnss_status() { msg.num_signals ); assert_eq!( - msg.source.to_string(), - "Skylark", - "incorrect value for msg.source, expected string '{}', is '{}'", - "Skylark", - msg.source + msg.source.as_bytes(), + &[83, 107, 121, 108, 97, 114, 107], + "incorrect value for msg.source, expected string '{:?}', is '{:?}'", + &[83, 107, 121, 108, 97, 114, 107], + msg.source.as_bytes() ); } _ => panic!("Invalid message type! Expected a MsgDgnssStatus"),