Root causes:
1. Ambiguous float types — added f32/f64 annotations to vec
declarations and variable bindings feeding .abs()/.max()/.min()
2. chrono API change — replaced with_hour(0) chain with
date_naive().and_hms_opt(0,0,0).unwrap().and_utc()
3. Missing dev-dependencies — added sqlx + base64 to [dev-dependencies]
4. Generic parse error — wrapped f32 comparison in parens
5. Incorrect assertion — 3^5=243 > 100, changed nodes to 1000
Files fixed (8):
- it_community_detection_4_3.rs (float type annotations)
- it_faceted_search_4_5.rs (chrono API + float)
- it_inference_engine_5_2.rs (float type annotations)
- it_path_finding_4_4.rs (float + assertion fix)
- it_query_reasoning_5_3.rs (float type annotations)
- it_semantic_retrieval_4_1.rs (sqlx/base64 deps + float)
- it_summarization_5_4.rs (parens for generic parse)
- it_temporal_filtering_4_2_fixed.rs (chrono API)
Result: 20 test suites, 0 failures, cargo build clean
This commit is contained in:
@@ -67,7 +67,7 @@ mod tests {
|
||||
/// Test: Score normalization (clamped to 0.0-1.0)
|
||||
#[test]
|
||||
fn test_score_normalization() {
|
||||
let test_scores = vec![
|
||||
let test_scores: Vec<(f32, f32)> = vec![
|
||||
(-0.5, 0.0), // Negative → 0.0
|
||||
(0.0, 0.0), // Valid → 0.0
|
||||
(0.5, 0.5), // Valid → 0.5
|
||||
@@ -76,7 +76,7 @@ mod tests {
|
||||
];
|
||||
|
||||
for (input, expected) in test_scores {
|
||||
let normalized = input.max(0.0).min(1.0);
|
||||
let normalized = input.max(0.0_f32).min(1.0_f32);
|
||||
assert_eq!(normalized, expected, "Normalizing {} should give {}", input, expected);
|
||||
}
|
||||
}
|
||||
@@ -84,15 +84,15 @@ mod tests {
|
||||
/// Test: RRF fusion weight validation
|
||||
#[test]
|
||||
fn test_rrf_weight_validation() {
|
||||
let sem_weight = 0.6;
|
||||
let lex_weight = 0.4;
|
||||
let sem_weight: f32 = 0.6;
|
||||
let lex_weight: f32 = 0.4;
|
||||
|
||||
assert!(sem_weight >= 0.0 && sem_weight <= 1.0);
|
||||
assert!(lex_weight >= 0.0 && lex_weight <= 1.0);
|
||||
|
||||
// Weights should be normalized
|
||||
let sem_normalized = sem_weight.max(0.0).min(1.0);
|
||||
let lex_normalized = lex_weight.max(0.0).min(1.0);
|
||||
let sem_normalized = sem_weight.max(0.0_f32).min(1.0_f32);
|
||||
let lex_normalized = lex_weight.max(0.0_f32).min(1.0_f32);
|
||||
|
||||
assert_eq!(sem_normalized, 0.6);
|
||||
assert_eq!(lex_normalized, 0.4);
|
||||
@@ -101,10 +101,10 @@ mod tests {
|
||||
/// Test: RRF fusion score calculation
|
||||
#[test]
|
||||
fn test_rrf_fusion_score_calculation() {
|
||||
let semantic_score = 0.92;
|
||||
let lexical_score = 0.85;
|
||||
let sem_weight = 0.6;
|
||||
let lex_weight = 0.4;
|
||||
let semantic_score: f32 = 0.92;
|
||||
let lexical_score: f32 = 0.85;
|
||||
let sem_weight: f32 = 0.6;
|
||||
let lex_weight: f32 = 0.4;
|
||||
|
||||
let fused_score = (sem_weight * semantic_score) + (lex_weight * lexical_score);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user