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

Function test_context_record_operations

atomic-core/src/crdt/apply/context.rs:948–978  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

946
947 #[test]
948 fn test_context_record_operations() {
949 let mut context = ApplyContext::with_defaults();
950
951 context.record_trunk_created();
952 context.record_trunk_deleted();
953 context.record_trunk_moved();
954 context.record_trunk_undeleted();
955 context.record_branch_inserted();
956 context.record_branch_deleted();
957 context.record_branch_restored();
958 context.record_leaf_inserted();
959 context.record_leaf_deleted();
960 context.record_leaf_replaced();
961 context.record_leaf_restored();
962 context.record_content_bytes(100);
963 context.record_skipped();
964
965 assert_eq!(context.stats().trunks_created(), 1);
966 assert_eq!(context.stats().trunks_deleted(), 1);
967 assert_eq!(context.stats().trunks_moved(), 1);
968 assert_eq!(context.stats().trunks_undeleted(), 1);
969 assert_eq!(context.stats().branches_inserted(), 1);
970 assert_eq!(context.stats().branches_deleted(), 1);
971 assert_eq!(context.stats().branches_restored(), 1);
972 assert_eq!(context.stats().leaves_inserted(), 1);
973 assert_eq!(context.stats().leaves_deleted(), 1);
974 assert_eq!(context.stats().leaves_replaced(), 1);
975 assert_eq!(context.stats().leaves_restored(), 1);
976 assert_eq!(context.stats().content_bytes_processed(), 100);
977 assert_eq!(context.stats().operations_skipped(), 1);
978 }
979
980 #[test]
981 fn test_context_add_conflict() {

Callers

nothing calls this directly

Calls 13

record_trunk_createdMethod · 0.80
record_trunk_deletedMethod · 0.80
record_trunk_movedMethod · 0.80
record_branch_deletedMethod · 0.80
record_leaf_insertedMethod · 0.80
record_leaf_deletedMethod · 0.80
record_leaf_replacedMethod · 0.80
record_leaf_restoredMethod · 0.80
record_content_bytesMethod · 0.80

Tested by

no test coverage detected