Runtime tests: port the GPU-time duration and host-clock tests the old runtime's deletion took
5d725aeec7 deleted the old runtime with its tests. Two of its GPU-time tests
(tests/gpu_time.rs) describe the new runtime's design as they stood and need
nothing new, so they come back unchanged in their answers:
- durations_count_ticks_of_the_period_across_a_wrap: the old GpuClock::duration,
now Ticks::span (Ticks::new takes the period first, then the valid bits).
- the_host_time_rises: host_time, now u64 nanoseconds where it was f64.
Verified: baseline runs pending (the runtime's tree as it stands at
development's tip, with only these tests added).
This commit is contained in:
1 parent
2b4219047e
commit
9e046ed8d2
2 files changed
+26
No files matched your search
@@ -152,6 +152,7 @@ mod take_split;
|
||||
mod texture;
|
||||
mod texture_accesses;
|
||||
mod texture_buffers;
|
||||
mod times;
|
||||
mod translate;
|
||||
mod translator_fields;
|
||||
mod unattached_colors;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//! A command buffer's times (`times.rs`) without a device: the durations of the GPU's ticks across
|
||||
//! the wrap of their valid bits, and the host clock they are placed on rising.
|
||||
|
||||
use crate::times::Ticks;
|
||||
|
||||
#[test]
|
||||
fn durations_count_ticks_of_the_period_across_a_wrap() {
|
||||
let ticks = Ticks::new(52.083_332, 36);
|
||||
assert_eq!(ticks.span(1_000, 1_000), 0);
|
||||
assert_eq!(ticks.span(1_000, 1_096), 5_000);
|
||||
// From 10 ticks before the 36 bits wrap to 5 after: 15 ticks.
|
||||
let before = (1u64 << 36) - 10;
|
||||
assert_eq!(ticks.span(before, 5), 781);
|
||||
// An end before the start is no duration.
|
||||
assert_eq!(ticks.span(1_096, 1_000), 0);
|
||||
let full = Ticks::new(1.0, 64);
|
||||
assert_eq!(full.span(u64::MAX - 1, 3), 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_host_time_rises() {
|
||||
let first = crate::host_time();
|
||||
let second = crate::host_time();
|
||||
assert!(first > 0 && second >= first, "{first} then {second}");
|
||||
}
|
||||
Reference in new issue
Block a user