MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / test_get_independent_headers_complex

Function test_get_independent_headers_complex

src/analysis/header.rs:443–475  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

441
442#[test]
443fn test_get_independent_headers_complex() {
444 // Create more complex test data, simulating cross-reference scenarios
445 let mut root1 = TreeNode::new("main.h".to_string());
446 let mut common = TreeNode::new("common.h".to_string());
447 let util1 = TreeNode::new("util1.h".to_string());
448 let util2 = TreeNode::new("util2.h".to_string());
449 common.add_child(util1);
450 common.add_child(util2);
451 root1.add_child(common);
452
453 let mut root2 = TreeNode::new("secondary.h".to_string());
454 let mut helper = TreeNode::new("helper.h".to_string());
455 let base = TreeNode::new("base.h".to_string());
456 helper.add_child(base);
457 root2.add_child(helper);
458
459 let trees = vec![root1, root2];
460
461 // Test the function
462 let result = get_independent_headers(&trees).unwrap();
463
464 // Verify results - should only return top-level independent headers
465 assert_eq!(result.len(), 2);
466 assert!(result.contains(&"main.h"));
467 assert!(result.contains(&"secondary.h"));
468
469 // These should not be in the results since they are included by other headers
470 assert!(!result.contains(&"common.h"));
471 assert!(!result.contains(&"util1.h"));
472 assert!(!result.contains(&"util2.h"));
473 assert!(!result.contains(&"helper.h"));
474 assert!(!result.contains(&"base.h"));
475}
476
477#[test]
478fn test_get_independent_headers_circular() {

Callers

nothing calls this directly

Calls 2

get_independent_headersFunction · 0.85
add_childMethod · 0.80

Tested by

no test coverage detected