MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_update_oldest_change

Function test_update_oldest_change

atomic-core/src/record/builder.rs:776–794  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

774
775 #[test]
776 fn test_update_oldest_change() {
777 let mut builder = RecordBuilder::new();
778
779 assert_eq!(builder.oldest_change(), SystemTime::UNIX_EPOCH);
780
781 let time1 = SystemTime::UNIX_EPOCH + std::time::Duration::from_secs(1000);
782 builder.update_oldest_change(time1);
783 assert_eq!(builder.oldest_change(), time1);
784
785 // Older time should update
786 let time2 = SystemTime::UNIX_EPOCH + std::time::Duration::from_secs(500);
787 builder.update_oldest_change(time2);
788 assert_eq!(builder.oldest_change(), time2);
789
790 // Newer time should not update
791 let time3 = SystemTime::UNIX_EPOCH + std::time::Duration::from_secs(2000);
792 builder.update_oldest_change(time3);
793 assert_eq!(builder.oldest_change(), time2);
794 }
795
796 // Finish Tests
797

Callers

nothing calls this directly

Calls 1

update_oldest_changeMethod · 0.80

Tested by

no test coverage detected