Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇

2.1 KB
Raw Blame
// ©AngelaMos | 2026
// real_plot_data.rs

use lisdex_fuzz::plot;

const REAL_PLOT: &str = include_str!("fixtures/plot_data.txt");

const CAMPAIGN_SECONDS: u64 = 600;

#[test]
fn the_curve_from_a_real_campaign_parses_whole() {
    let curve = plot::parse(REAL_PLOT).expect("a plot_data AFL++ actually wrote must parse");
    assert!(
        curve.samples().len() > 100,
        "this capture is the 600s magma libpng campaign the M8 gate ran; a parser that read only its first rows would still look green on a synthetic two-row fixture"
    );
}

#[test]
fn the_campaign_ran_for_the_duration_it_was_given() {
    let curve = plot::parse(REAL_PLOT).unwrap();
    assert_eq!(
        curve.duration_secs(),
        CAMPAIGN_SECONDS,
        "relative_time is seconds since the campaign began, and the last row should land on the wall-clock limit the run was given"
    );
}

#[test]
fn coverage_only_grows_within_one_real_campaign() {
    let curve = plot::parse(REAL_PLOT).unwrap();
    assert!(
        curve.edges_are_monotonic(),
        "edges_found cannot fall inside a single campaign; if this fails the capture was resumed over or concatenated, and any first-to-last coverage delta computed from it would be wrong"
    );
    let last = curve.last().expect("a real campaign wrote rows");
    assert_eq!(curve.peak_edges(), last.edges_found);
}

#[test]
fn the_real_curve_carries_the_numbers_a_campaign_report_needs() {
    let curve = plot::parse(REAL_PLOT).unwrap();
    let last = curve.last().unwrap();
    assert!(last.edges_found > 0, "no coverage was recorded at all");
    assert!(last.total_execs > 0, "no executions were recorded at all");
    assert!(
        last.execs_per_sec > 0.0,
        "execs_per_sec is one of the two numbers M6's exit gate asks to be recorded"
    );
    assert!(
        last.map_size_pct > 0.0 && last.map_size_pct < 100.0,
        "map_size is a percentage of the coverage bitmap and must survive its percent suffix as a number"
    );
    assert!(
        last.corpus_count > 0,
        "a campaign that kept no corpus entry never made progress"
    );
}