pub struct Generator { /* private fields */ }Expand description
Program generator using grammar-based generation
Implementations§
Source§impl Generator
impl Generator
Sourcepub fn generate(
&self,
strategy: SamplingStrategy,
count: usize,
) -> Result<Vec<GeneratedCode>>
pub fn generate( &self, strategy: SamplingStrategy, count: usize, ) -> Result<Vec<GeneratedCode>>
Sourcepub fn generate_swarm(
&self,
count: usize,
max_depth: usize,
features_per_batch: usize,
seed: u64,
) -> Vec<GeneratedCode>
pub fn generate_swarm( &self, count: usize, max_depth: usize, features_per_batch: usize, seed: u64, ) -> Vec<GeneratedCode>
Generate code samples using swarm testing
Uses random feature subsets per batch to explore different combinations of language features (Groce et al. 2012).
Sourcepub fn generate_swarm_with_stats(
&self,
count: usize,
max_depth: usize,
features_per_batch: usize,
seed: u64,
) -> (Vec<GeneratedCode>, SwarmStats)
pub fn generate_swarm_with_stats( &self, count: usize, max_depth: usize, features_per_batch: usize, seed: u64, ) -> (Vec<GeneratedCode>, SwarmStats)
Generate swarm test cases with statistics
Returns both the generated programs and swarm testing statistics.
Sourcepub fn generate_coverage_guided(
&self,
count: usize,
max_depth: usize,
seed: u64,
) -> Vec<GeneratedCode>
pub fn generate_coverage_guided( &self, count: usize, max_depth: usize, seed: u64, ) -> Vec<GeneratedCode>
Generate code samples using coverage-guided (NAUTILUS-style) generation
This uses a corpus of interesting inputs and coverage feedback to prioritize unexplored AST paths.
Sourcepub fn generate_coverage_guided_with_map(
&self,
count: usize,
max_depth: usize,
seed: u64,
initial_coverage: Option<&CoverageMap>,
) -> (Vec<GeneratedCode>, CoverageStats)
pub fn generate_coverage_guided_with_map( &self, count: usize, max_depth: usize, seed: u64, initial_coverage: Option<&CoverageMap>, ) -> (Vec<GeneratedCode>, CoverageStats)
Generate code samples using coverage-guided generation with custom coverage map
Allows providing an existing coverage map to continue exploration.
Note: initial_coverage parameter reserved for incremental coverage seeding
in future releases.
Sourcepub fn generate_exhaustive(&self, max_depth: usize) -> Vec<GeneratedCode>
pub fn generate_exhaustive(&self, max_depth: usize) -> Vec<GeneratedCode>
Generate all programs exhaustively up to a given depth
Uses language-specific enumerators to systematically enumerate all valid programs up to the specified AST depth.
Sourcepub fn generate_with_stats(&self, max_depth: usize) -> GenerationStats
pub fn generate_with_stats(&self, max_depth: usize) -> GenerationStats
Generate programs with validation statistics
Returns both the generated programs and validation metrics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Generator
impl !RefUnwindSafe for Generator
impl Send for Generator
impl Sync for Generator
impl Unpin for Generator
impl UnsafeUnpin for Generator
impl !UnwindSafe for Generator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more