🎨 Lay out the scratch and spares tests as rustfmt does
This commit is contained in:
1 parent
c3b72c6ee5
commit
01799cebaa
2 files changed
+30
-7
No files matched your search
@@ -1320,7 +1320,11 @@ mod tests {
|
||||
let before = zeroed();
|
||||
let buffer = scratch(100_000, 0).expect("a Shared scratch buffer");
|
||||
assert_eq!(
|
||||
(buffer.length(), buffer.storage_mode(), buffer.resource_options()),
|
||||
(
|
||||
buffer.length(),
|
||||
buffer.storage_mode(),
|
||||
buffer.resource_options()
|
||||
),
|
||||
(100_000, 0, 0x200)
|
||||
);
|
||||
assert_ne!(buffer.contents(), HostPtr::NULL);
|
||||
@@ -1330,12 +1334,21 @@ mod tests {
|
||||
let before = zeroed();
|
||||
let plain = (device.new_buffer_of_length(on, 100_000, 0)).expect("never a raise");
|
||||
assert!(plain.is_some());
|
||||
assert!(zeroed() >= before + 100_000, "a new buffer's bytes are zeroed");
|
||||
assert!(
|
||||
zeroed() >= before + 100_000,
|
||||
"a new buffer's bytes are zeroed"
|
||||
);
|
||||
|
||||
let before = zeroed();
|
||||
let private = scratch(4096, 0x20).expect("a Private scratch buffer");
|
||||
assert_eq!((private.storage_mode(), private.contents()), (2, HostPtr::NULL));
|
||||
assert!(zeroed() >= before + 4096, "a Private one is made as any, zeroed");
|
||||
assert_eq!(
|
||||
(private.storage_mode(), private.contents()),
|
||||
(2, HostPtr::NULL)
|
||||
);
|
||||
assert!(
|
||||
zeroed() >= before + 4096,
|
||||
"a Private one is made as any, zeroed"
|
||||
);
|
||||
|
||||
assert!(scratch(0, 0).is_none() && scratch(64, 0x30).is_none());
|
||||
}
|
||||
|
||||
@@ -13396,7 +13396,11 @@ pub(super) mod tests {
|
||||
let done = download(&r, BLOCK);
|
||||
let made = copies(&r.p.call_log().since(mark));
|
||||
assert_eq!(made.len(), 2, "{made:?}");
|
||||
assert_eq!((made[0].1, made[1].0), (cache, cache), "a fill, then a download");
|
||||
assert_eq!(
|
||||
(made[0].1, made[1].0),
|
||||
(cache, cache),
|
||||
"a fill, then a download"
|
||||
);
|
||||
assert_ne!(
|
||||
made[1].1, made[0].0,
|
||||
"the download's buffer is not the fill's, whose copy is in flight"
|
||||
@@ -13461,7 +13465,10 @@ pub(super) mod tests {
|
||||
let out = copies(&calls);
|
||||
assert_eq!(out.len(), 3, "a copy a row: {out:?}");
|
||||
let staging = out[0].1;
|
||||
assert!(out.iter().all(|&(from, to)| (from, to) == (out[0].0, staging)));
|
||||
assert!(
|
||||
out.iter()
|
||||
.all(|&(from, to)| (from, to) == (out[0].0, staging))
|
||||
);
|
||||
let parts = offsets(&calls);
|
||||
assert_eq!(
|
||||
parts,
|
||||
@@ -13481,7 +13488,10 @@ pub(super) mod tests {
|
||||
let at = at as u64;
|
||||
match at / pitch < rows && at % pitch < texels {
|
||||
true => assert_eq!(now, 0xc3, "byte {at:#x}, a texel: the GPU's copy's"),
|
||||
false => assert_eq!(now, was, "byte {at:#x}, padding or past the rows: the CPU's"),
|
||||
false => assert_eq!(
|
||||
now, was,
|
||||
"byte {at:#x}, padding or past the rows: the CPU's"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user