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

Function test_credit_range_try_extend

atomic-core/src/change/credit.rs:1046–1068  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1044
1045 #[test]
1046 fn test_credit_range_try_extend() {
1047 let credit = Credit::human("alice", None::<String>, test_hash(), test_timestamp());
1048 let mut range = CreditRange::new(10, 15, credit.clone());
1049
1050 // Should extend with same credit and adjacent line
1051 assert!(range.try_extend(16, &credit));
1052 assert_eq!(range.end_line, 16);
1053
1054 // Should not extend with non-adjacent line
1055 assert!(!range.try_extend(18, &credit));
1056
1057 // Should not extend with different credit
1058 let other = Credit::ai_generated(
1059 "bob",
1060 None::<String>,
1061 AIVendor::Anthropic,
1062 "claude",
1063 test_hash(),
1064 test_timestamp(),
1065 None,
1066 );
1067 assert!(!range.try_extend(17, &other));
1068 }
1069
1070 // FileCredits Tests
1071

Callers

nothing calls this directly

Calls 4

humanFunction · 0.85
test_timestampFunction · 0.85
test_hashFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected