use debtmap::data_flow::DataFlowGraph;
use debtmap::priority::{CallGraph, FilterStatistics, ImpactMetrics, UnifiedAnalysis};
use im::Vector;
#[test]
fn test_unified_analysis_json_serialization() {
let analysis = UnifiedAnalysis {
items: Vector::new(),
file_items: Vector::new(),
total_impact: ImpactMetrics {
coverage_improvement: 0.0,
lines_reduction: 0,
complexity_reduction: 0.0,
risk_reduction: 0.0,
},
total_debt_score: 0.0,
debt_density: 0.0,
total_lines_of_code: 0,
call_graph: CallGraph::new(),
data_flow_graph: DataFlowGraph::new(),
overall_coverage: None,
has_coverage_data: false,
timings: None,
stats: FilterStatistics::new(),
analyzed_files: std::collections::HashMap::new(),
};
let result = serde_json::to_string_pretty(&analysis);
assert!(
result.is_ok(),
"Failed to serialize UnifiedAnalysis to JSON: {:?}",
result.err()
);
if let Ok(json_str) = result {
let parsed: Result<serde_json::Value, _> = serde_json::from_str(&json_str);
assert!(parsed.is_ok(), "Generated invalid JSON");
}
}
#[test]
fn test_data_flow_graph_serialization() {
let data_flow_graph = DataFlowGraph::new();
let result = serde_json::to_string(&data_flow_graph);
assert!(
result.is_ok(),
"DataFlowGraph serialization failed: {:?}",
result.err()
);
}