enc 0.19.0

This library aids in processing encoded data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::Validator;
use crate::test::hex;

/// Tests the `validator`.
pub fn test_validator<V, I>(validator: &V, test_cases: &[(I, bool)])
where
    V: Validator,
    I: AsRef<[u8]>,
{
    for (input, expected) in test_cases {
        let input: &[u8] = input.as_ref();

        let result: bool = validator.is_valid(input).unwrap();
        assert_eq!(result, *expected, "input={}", hex(input));
    }
}