Struct fuzzcheck::sensors_and_pools::ArrayOfCounters[][src]

pub struct ArrayOfCounters<const N: usize> { /* fields omitted */ }
Expand description

A custom sensor consisting of an array of counters that can be manually set.

use fuzzcheck::sensors_and_pools::ArrayOfCounters;
// the “counters” array must be a static item
static mut COUNTERS: [u64; 2] = [0; 2];

// inside the fuzz test, you can create the sensor as follows
let sensor = ArrayOfCounters::new(unsafe { &mut COUNTERS });

fn test_function(x: &[bool]) {
    // you can then manually instrument a test function by changing the values of COUNTERS
    unsafe {
        COUNTERS[0] = x.len() as u64;
    }
    // ...
    unsafe {
        COUNTERS[1] = x.len() as u64;
    }
    // ...
}

The ObservationHandler of this sensor has the same type as the one from the default code coverage sensor. Therefore, most pools that are compatible with the code coverage sensor will also be compatible with the ArrayOfCounters sensor.

You can also use a different pool such as the UniqueValuesPool

Implementations

Trait Implementations

A type that is used to retrieve the observations made by the sensor. Read more

Signal to the sensor that it should prepare to record observations

Signal to the sensor that it should stop recording observations

Access the sensor’s observations through the handler

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.