MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / test_per_file_cap_limits_single_file

Function test_per_file_cap_limits_single_file

src/context/builder.rs:1067–1087  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1065
1066 #[test]
1067 fn test_per_file_cap_limits_single_file() {
1068 let candidates = vec![
1069 make_search_result("fn1", "src/big.rs", 10.0),
1070 make_search_result("fn2", "src/big.rs", 9.0),
1071 make_search_result("fn3", "src/big.rs", 8.0),
1072 make_search_result("fn4", "src/other.rs", 7.0),
1073 ];
1074 let result = apply_per_file_cap(candidates, 10, 2);
1075 // Only 2 from big.rs, then other.rs, then spillover
1076 let big_count = result
1077 .iter()
1078 .filter(|n| n.file_path == "src/big.rs")
1079 .count();
1080 assert!(big_count <= 3); // 2 accepted + possibly 1 spillover
1081 assert!(result.len() == 4);
1082 // First 2 slots for big.rs, 3rd for other.rs
1083 assert_eq!(result[0].name, "fn1");
1084 assert_eq!(result[1].name, "fn2");
1085 assert_eq!(result[2].name, "fn4");
1086 assert_eq!(result[3].name, "fn3"); // spillover
1087 }
1088
1089 #[test]
1090 fn test_per_file_cap_respects_max_total() {

Callers

nothing calls this directly

Calls 2

apply_per_file_capFunction · 0.85
countMethod · 0.80

Tested by

no test coverage detected