mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
Reviewed-on: https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1136 Co-authored-by: Odd E. Ebbesen <git@oddware.net> Co-committed-by: Odd E. Ebbesen <git@oddware.net>
This commit is contained in:
committed by
Jade Ellis
parent
910a3182f7
commit
cb7875e479
@@ -276,3 +276,22 @@ async fn set_intersection_sorted_stream2() {
|
||||
.await;
|
||||
assert!(r.eq(&["ccc", "ggg", "iii"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn is_within_bounds() {
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use utils::time::{TimeDirection, is_within_bounds};
|
||||
|
||||
let now = SystemTime::now();
|
||||
let yesterday = now - Duration::from_secs(86400);
|
||||
assert!(is_within_bounds(yesterday, now, TimeDirection::Before));
|
||||
assert!(!is_within_bounds(yesterday, now, TimeDirection::After));
|
||||
|
||||
let tomorrow = now + Duration::from_secs(86400);
|
||||
assert!(is_within_bounds(tomorrow, now, TimeDirection::After));
|
||||
assert!(!is_within_bounds(tomorrow, now, TimeDirection::Before));
|
||||
|
||||
assert!(is_within_bounds(now, now, TimeDirection::Before));
|
||||
assert!(is_within_bounds(now, now, TimeDirection::After));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user