From c57b5d78b7f24ac3ebb58326ed96f6bfb8b2bf0e Mon Sep 17 00:00:00 2001 From: Mansur Azatbek Date: Thu, 31 Aug 2023 13:31:25 +0600 Subject: [PATCH] test: changed tests --- flexible_inspect_rs/tests/api.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/flexible_inspect_rs/tests/api.rs b/flexible_inspect_rs/tests/api.rs index eda1320..30adcb0 100644 --- a/flexible_inspect_rs/tests/api.rs +++ b/flexible_inspect_rs/tests/api.rs @@ -1,22 +1,19 @@ use flexible_inspect_rs::prelude::*; #[test] -fn main_rust() { - let text = b"0x0E 0x0F 0x10 0x11"; +fn test_range_from_le_bytes() { + // number is 10 + let text = [10, 0, 0, 0]; let cartr_1 = Cartridge::new( 0, "not converted to number", - [ - RuleBytes::new(r"0x..", MatchRequirement::MustBeFound).number_range( - 0..=100, - ReadMode::FromBeBytes, - RangeMode::Any, - ), - ], + [RuleBytes::new( + r"\x0A\x00\x00\x00|\x0C\x00\x00\x00|\x50\x00\x00\x00|\x5A\x00\x00\x00", + MatchRequirement::MustBeFound, + ) + .number_range(0..=2500, ReadMode::FromLeBytes, RangeMode::Any)], ); - // dbg!(&cartr_1); - let validator = TemplateValidator::new([cartr_1]); dbg!(validator.validate(text.as_ref())); }