assertables

Macro assert_io_read_to_string_le

source
macro_rules! assert_io_read_to_string_le {
    ($a_reader:expr, $b:expr $(,)?) => { ... };
    ($a_reader:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a std::io::Read read_to_string() value is less than or equal to another.

Pseudocode:
(reader1.read_to_string(a) ⇒ a) ≤ (reader2.read_to_string(b) ⇒ b)

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;
use std::io::Read;

let mut a = "alfa".as_bytes();
let mut b = "bravo".as_bytes();
assert_io_read_to_string_le!(a, b);

// This will panic
let mut a = "bravo".as_bytes();
let mut b = "alfa".as_bytes();
assert_io_read_to_string_le!(a, b);
// assertion failed: `assert_io_read_to_string_le!(a_reader, b_reader)`
// https://docs.rs/assertables/8.17.0/assertables/macro.assert_io_read_to_string_le.html
//  a label: `a`,
//  a debug: `[]`,
//  b label: `b`,
//  b debug: `[]`,
//        a: `\"bravo\"`,
//        b: `\"alfa\"`

§Module macros