MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_idle_detection_after_threshold

Function test_idle_detection_after_threshold

core/src/ahp/executor_tests.rs:347–363  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

345
346#[test]
347fn test_idle_detection_after_threshold() {
348 let executor = make_test_executor();
349 // Simulate old last activity (11 seconds ago)
350 let old_time = std::time::SystemTime::now()
351 .duration_since(std::time::UNIX_EPOCH)
352 .unwrap()
353 .as_millis() as u64
354 - 11_000;
355 executor.last_activity.store(old_time, Ordering::Relaxed);
356
357 let idle_event = executor.check_idle();
358 assert!(idle_event.is_some());
359 let idle = idle_event.unwrap();
360 assert!(idle.idle_duration_ms >= 10_000);
361 assert_eq!(idle.idle_reason, "no_activity");
362 assert_eq!(idle.suggested_action, Some("dream".to_string()));
363}
364
365#[test]
366fn test_record_event_updates_activity() {

Callers

nothing calls this directly

Calls 4

make_test_executorFunction · 0.85
nowFunction · 0.85
storeMethod · 0.80
check_idleMethod · 0.80

Tested by

no test coverage detected