MCPcopy Create free account
hub / github.com/aws/clock-bound / selected_clock_source_display

Function selected_clock_source_display

clock-bound/src/daemon/selected_clock.rs:314–338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

312
313 #[test]
314 fn selected_clock_source_display() {
315 let clock = SelectedClockSource::default();
316 assert_eq!(clock.to_string(), "INIT (stratum 0)");
317
318 clock.set_to_phc();
319 assert_eq!(clock.to_string(), "PHC (stratum 0)");
320
321 clock.set_to_vmclock();
322 assert_eq!(clock.to_string(), "VMClock (stratum 0)");
323
324 clock.set_to_server("169.254.169.123".parse().unwrap(), Stratum::ONE);
325 assert_eq!(
326 clock.to_string(),
327 "Server([169, 254, 169, 123]) (stratum 1)"
328 );
329
330 clock.set_to_server("169.254.169.123".parse().unwrap(), Stratum::TWO);
331 assert_eq!(
332 clock.to_string(),
333 "Server([169, 254, 169, 123]) (stratum 2)"
334 );
335
336 clock.set_to_none();
337 assert_eq!(clock.to_string(), "None (stratum 16)");
338 }
339}

Callers

nothing calls this directly

Calls 5

set_to_phcMethod · 0.80
set_to_vmclockMethod · 0.80
set_to_serverMethod · 0.80
set_to_noneMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected