[domistream] Host: session test, fixes, mutation, L1 measurement, 0.2.0 #14
@@ -497,6 +497,24 @@ fn applist_caps() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn applist_cap_is_reachable_with_full_apps() {
|
||||
// Hosts write four elements per app (App, AppTitle, ID, IsHdrSupported; the host writer does too): a list of
|
||||
// MAX_APPS such apps plus the root must fit the XML element cap, so a list at the app cap parses (one app more is
|
||||
// refused, by whichever cap comes first; `applist_caps` checks the app cap itself with three-element apps).
|
||||
use domistream::http::applist::MAX_APPS;
|
||||
let full = |n: usize| {
|
||||
(0..n)
|
||||
.map(|i| format!("<App><AppTitle>g</AppTitle><ID>{i}</ID><IsHdrSupported>1</IsHdrSupported></App>"))
|
||||
.collect::<String>()
|
||||
};
|
||||
assert!(1 + 4 * MAX_APPS <= MAX_XML_ELEMENTS, "root + 4 per app = {} elements", 1 + 4 * MAX_APPS);
|
||||
let apps = http::parse_app_list(&xml_root(200, &full(MAX_APPS))).expect("a full list at the app cap");
|
||||
assert_eq!(apps.len(), MAX_APPS);
|
||||
assert!(apps.iter().all(|a| a.hdr_supported));
|
||||
assert_err!(http::parse_app_list(&xml_root(200, &full(MAX_APPS + 1))), Error::TooLarge { .. });
|
||||
}
|
||||
|
||||
// ================================================================================================ launch
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user