use http2::{ Flags,
FrameType,
Parser,
ParserState };
use http2::test::*;
#[test]
fn is_exclusive() {
let mut v = Vec::new();
pack_u32!(
v,
(40 << 8) | 0x2
);
pack_u8!(v, 0);
pack_u32!(v, 0x7FFFFFFF);
pack_u32!(
v,
(1 << 31) | 42
);
pack_u8!(
v,
99
);
let mut h = DebugHandler::new();
let mut p = Parser::new();
p.resume(&mut h, &v);
assert!(Flags::from_u8(h.frame_flags).is_empty());
assert_eq!(
FrameType::from_u8(h.frame_type),
FrameType::Priority
);
assert!(h.priority_exclusive);
assert_eq!(
h.priority_stream_id,
42
);
assert_eq!(
h.priority_weight,
99
);
assert_eq!(
p.state(),
ParserState::FrameLength1
);
}
#[test]
fn is_not_exclusive() {
let mut v = Vec::new();
pack_u32!(
v,
(40 << 8) | 0x2
);
pack_u8!(v, 0);
pack_u32!(v, 0x7FFFFFFF);
pack_u32!(
v,
(0 << 31) | 42
);
pack_u8!(
v,
99
);
let mut h = DebugHandler::new();
let mut p = Parser::new();
p.resume(&mut h, &v);
assert!(Flags::from_u8(h.frame_flags).is_empty());
assert_eq!(
FrameType::from_u8(h.frame_type),
FrameType::Priority
);
assert!(!h.priority_exclusive);
assert_eq!(
h.priority_stream_id,
42
);
assert_eq!(
h.priority_weight,
99
);
assert_eq!(
p.state(),
ParserState::FrameLength1
);
}