Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions crates/terraphim_rolegraph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ mod tests {
.unwrap()
}

#[test]
#[tokio::test]
async fn test_split_paragraphs() {
let paragraph = "This is the first sentence.\n\n This is the second sentence. This is the second sentence? This is the second sentence| This is the second sentence!\n\nThis is the third sentence. Mr. John Johnson Jr. was born in the U.S.A but earned his Ph.D. in Israel before joining Nike Inc. as an engineer. He also worked at craigslist.org as a business analyst.";
let sentences = split_paragraphs(paragraph);
Expand All @@ -1522,7 +1522,7 @@ mod tests {
);
}

#[test]
#[tokio::test]
async fn test_find_matching_node_idss() {
let query = "I am a text with the word Life cycle concepts and bar and Trained operators and maintainers, project direction, some bingo words Paradigm Map and project planning, then again: some bingo words Paradigm Map and project planning, then repeats: Trained operators and maintainers, project direction";
let role = "system operator".to_string();
Expand All @@ -1534,7 +1534,7 @@ mod tests {
assert_eq!(matches.len(), 7);
}

#[test]
#[tokio::test]
async fn test_find_matching_node_idss_ac_values() {
let query = "life cycle framework I am a text with the word Life cycle concepts and bar and Trained operators and maintainers, project direction, some bingo words Paradigm Map and project planning, then again: some bingo words Paradigm Map and project planning, then repeats: Trained operators and maintainers, project direction";
let role = "system operator".to_string();
Expand All @@ -1554,7 +1554,7 @@ mod tests {
);
}

#[test]
#[tokio::test]
async fn test_terraphim_engineer() {
let role_name = "Terraphim Engineer".to_string();
const DEFAULT_HAYSTACK_PATH: &str = "docs/src/";
Expand Down Expand Up @@ -1661,7 +1661,7 @@ mod tests {
println!("Edges count {:?}", rolegraph.edges.len());
}

#[test]
#[tokio::test]
async fn test_rolegraph() {
let role = "system operator".to_string();
let mut rolegraph = RoleGraph::new(role.into(), load_sample_thesaurus().await)
Expand Down Expand Up @@ -1720,7 +1720,7 @@ mod tests {
assert_eq!(results.len(), 4);
}

#[test]
#[tokio::test]
#[ignore]
async fn test_is_all_terms_connected_by_path_true() {
let role = "system operator".to_string();
Expand All @@ -1731,7 +1731,7 @@ mod tests {
assert!(rolegraph.is_all_terms_connected_by_path(text));
}

#[test]
#[tokio::test]
async fn test_is_all_terms_connected_by_path_false() {
let role = "system operator".to_string();
let rolegraph = RoleGraph::new(role.into(), load_sample_thesaurus().await)
Expand Down Expand Up @@ -2156,14 +2156,14 @@ mod tests {
}

// TriggerIndex unit tests
#[test]
#[tokio::test]
async fn tfidf_empty_index_returns_empty() {
let index = TriggerIndex::new(0.3);
let results = index.query("any query");
assert!(results.is_empty());
}

#[test]
#[tokio::test]
async fn tfidf_exact_match_scores_high() {
let mut index = TriggerIndex::new(0.3);
let mut triggers = AHashMap::new();
Expand All @@ -2176,7 +2176,7 @@ mod tests {
assert!(results[0].1 >= 0.3); // Above threshold
}

#[test]
#[tokio::test]
async fn tfidf_no_match_scores_zero() {
let mut index = TriggerIndex::new(0.3);
let mut triggers = AHashMap::new();
Expand All @@ -2188,7 +2188,7 @@ mod tests {
assert!(results.is_empty() || results.iter().all(|(_, score)| *score < 0.3));
}

#[test]
#[tokio::test]
async fn tfidf_partial_match() {
let mut index = TriggerIndex::new(0.1); // Lower threshold for partial match
let mut triggers = AHashMap::new();
Expand All @@ -2201,7 +2201,7 @@ mod tests {
assert!(results[0].1 > 0.0 && results[0].1 < 1.0);
}

#[test]
#[tokio::test]
async fn tfidf_threshold_filters() {
let mut index = TriggerIndex::new(0.8); // High threshold
let mut triggers = AHashMap::new();
Expand All @@ -2217,7 +2217,7 @@ mod tests {
}

// Integration tests for two-pass search
#[test]
#[tokio::test]
async fn two_pass_aho_corasick_first() {
// Create a simple scenario where Aho-Corasick finds matches
let mut index = TriggerIndex::new(0.3);
Expand Down
Loading