#hex #protocols #format #panics #display #assert

dev assert_hex

display assert panics in hexadecimal {:#x?} format

8 unstable releases (3 breaking)

0.4.1 Sep 17, 2023
0.4.0 Sep 11, 2023
0.3.0 Aug 30, 2023
0.2.2 Jan 30, 2021
0.1.0 Mar 9, 2020

#142 in Testing

Download history 793/week @ 2024-08-02 470/week @ 2024-08-09 382/week @ 2024-08-16 460/week @ 2024-08-23 1020/week @ 2024-08-30 413/week @ 2024-09-06 382/week @ 2024-09-13 633/week @ 2024-09-20 517/week @ 2024-09-27 537/week @ 2024-10-04 476/week @ 2024-10-11 649/week @ 2024-10-18 501/week @ 2024-10-25 653/week @ 2024-11-01 483/week @ 2024-11-08 517/week @ 2024-11-15

2,355 downloads per month
Used in 14 crates

MIT license

7KB
118 lines

assert_hex

Latest Version Rust Documentation Crates.io

display expression using {:#x?} format when false assertion causes panic!().

Why

Writing and testing protocol level libraries requires many tests to be written with respect to byte level protocol sections in hex. This library simplifies the process of viewing the differences between these types when tests fail by displaying by using the {:#x?} representation.

Usage

Compiler support: requires rustc 1.39+

$ cargo add assert_hex

Replace assert_eq or assert_ne with assert_eq_hex or assert_ne_hex respectively.

Changelog

See CHANGELOG.md


lib.rs:

assert_hex

display expression using {:#x?} format when false assertion causes panic!().

why

Writing and testing protocol level libraries requires many tests to be written with respect to byte level protocol sections in hex. This library simplifies the process of viewing the differences between these types when tests fail by displaying by using the {:#x?} representation.

usage

Replace assert_eq or assert_ne with assert_eq_hex or assert_ne_hex respectively.

No runtime deps