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 e2b6a1335d..c5e5a0899c 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs and b/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs differ diff --git a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs index 61d34a384d..41539cb89c 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs and b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs differ diff --git a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs index 67bec15fb1..eb16b9b5ff 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs and b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs differ 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 b68a63cf62..3f635a6e69 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs and b/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs differ 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"),