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
Download history 273/week @ 2024-06-07 551/week @ 2024-06-14 842/week @ 2024-06-21 687/week @ 2024-06-28 721/week @ 2024-07-05 507/week @ 2024-07-12 664/week @ 2024-07-19 714/week @ 2024-07-26 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 622/week @ 2024-09-20

2,525 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