#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_nullability_lattice() {
use NullabilityLattice::*;
assert_eq!(NotNull.join(&NotNull), NotNull);
assert_eq!(NotNull.join(&MaybeNull), MaybeNull);
assert_eq!(NotNull.join(&Null), Bottom);
assert_eq!(Top.join(&NotNull), Top);
}
#[test]
fn test_property_domain_join() {
let domain1 = PropertyDomain::top();
let domain2 = PropertyDomain {
nullability: NullabilityLattice::NotNull,
bounds: IntervalLattice {
lower: Some(0),
upper: Some(100),
},
aliasing: AliasLattice::NoAlias,
purity: PurityLattice::Pure,
};
let joined = domain1.join(&domain2);
assert_eq!(joined.nullability, NullabilityLattice::Top);
}
#[tokio::test]
async fn test_incremental_analysis() {
let analyzer = LightweightProvabilityAnalyzer::new();
let functions = vec![FunctionId {
file_path: "src/main.rs".to_string(),
function_name: "main".to_string(),
line_number: 10,
}];
let summaries = analyzer.analyze_incrementally(&functions).await;
assert!(!summaries.is_empty());
assert!(summaries[0].analysis_time_us < 1000); }
}
#[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);
}
}
}