#[cfg(test)]
mod contract_default_tests {
use super::*;
#[test]
fn test_default_tdg_threshold() {
assert!((default_tdg_threshold() - 1.5).abs() < f64::EPSILON);
}
#[test]
fn test_default_target_complexity() {
assert_eq!(default_target_complexity(), 10);
}
#[test]
fn test_default_timeout() {
assert_eq!(default_timeout(), 60);
}
#[test]
fn test_analyze_tdg_contract_serde_defaults() {
let json = r#"{"base":{}}"#;
let contract: AnalyzeTdgContract = serde_json::from_str(json).unwrap();
assert!((contract.threshold - 1.5).abs() < f64::EPSILON);
assert!(!contract.include_components);
assert!(!contract.critical_only);
}
#[test]
fn test_refactor_auto_contract_serde_defaults() {
let json = r#"{"file":"test.rs"}"#;
let contract: RefactorAutoContract = serde_json::from_str(json).unwrap();
assert_eq!(contract.target_complexity, 10);
assert_eq!(contract.timeout, 60);
assert!(!contract.dry_run);
}
}
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod property_tests {
use proptest::prelude::*;
proptest! {
#[test]
fn basic_property_stability(_input in ".*") {
prop_assert!(true);
}
#[test]
fn module_consistency_check(_x in 0u32..1000) {
prop_assert!(_x < 1001);
}
}
}