Skip to main content

assay_sim/
lib.rs

1pub mod attacks;
2pub mod corpus;
3pub mod differential;
4pub mod mutators;
5pub mod report;
6pub mod suite;
7
8pub use report::{AttackResult, AttackStatus, SimReport};
9pub use suite::{run_suite, SuiteConfig, SuiteTier};
10
11#[cfg(test)]
12mod tests {
13    use super::*;
14    use std::path::PathBuf;
15
16    #[test]
17    fn test_quick_suite() {
18        let cfg = SuiteConfig {
19            tier: SuiteTier::Quick,
20            target_bundle: PathBuf::from("placeholder"), // dynamic generation in suite for now
21            seed: 42,
22            verify_limits: None,
23        };
24
25        let report = run_suite(cfg).expect("Suite failed to run");
26
27        // Assert Summary
28        println!("Report Summary: {:?}", report.summary);
29
30        // We expect:
31        // 1. attacks checks (BitFlip, Truncate, Inject, ZipBomb, TarDuplicate, Bom, Crlf, BundleSize) -> Blocked (count=8)
32        // 2. differential -> Passed (count=1)
33        // Total = 9, Blocked=8, Passed=1, Bypassed=0
34        if report.summary.blocked != 8 || report.summary.passed != 1 {
35            println!("{}", serde_json::to_string_pretty(&report).unwrap());
36        }
37        assert_eq!(report.summary.blocked, 8, "Expected 8 blocked attacks");
38        assert_eq!(report.summary.passed, 1, "Expected 1 passed check");
39        assert_eq!(report.summary.bypassed, 0, "Expected 0 bypassed attacks");
40    }
41}