#[macro_use] extern crate scan_rules;
#[macro_use] mod util;
use scan_rules::scanner::{
Octal, Hex,
exact_width_a, max_width_a, min_width_a,
};
#[test]
fn test_runtime_scanner() {
assert_match!(
scan!("0123456789"; (
let a <| exact_width_a::<i32>(3),
let b <| max_width_a::<Hex<i32>>(2),
let c <| min_width_a::<Octal<i32>>(2),
..d
) => (a, b, c, d)),
Ok((12, 0x34, 0o567, "89"))
);
}
#[cfg(feature="regex")]
#[test]
fn test_runtime_scanner_re() {
use scan_rules::scanner::re_str;
assert_match!(
scan!("0123456789"; (
let a <| re_str(r"[0-9]{3}[:xdigit:]{0,2}[0-7]{2,}"),
let b <| re_str(r"9")
) => (a, b)),
Ok(("01234567", "9"))
);
}