Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// License: see LICENSE file at root directory of `master` branch

use {
    core::convert::TryFrom,
    htt::{Result, Status},
};

#[test]
fn statuses() -> Result<()> {
    for (bytes, code) in vec![(&[b'2', b'0', b'0'][..], 200_u16), (&[b'4', b'0', b'4'][..], 404), (&[b'5', b'0', b'0'][..], 500)] {
        assert_eq!(Status::try_from(bytes)?.code(), code);
    }

    [&[][..], &[b'9', b'0', b'1'][..], &[b'9'][..], &[b'1', b'0', b'0', b'1'][..]].iter().for_each(|b| drop(Status::try_from(*b).unwrap_err()));

    Ok(())
}