Skip to content

Commit 18f5378

Browse files
committed
Minor adjustments to FixedLenVecMutator
1 parent 64b00b5 commit 18f5378

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fuzzcheck/src/mutators/fixed_len_vector.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ where
9393
mutators,
9494
initialized: Cell::new(false),
9595
min_complexity: Cell::new(std::f64::INFINITY),
96-
max_complexity: Cell::default(),
97-
search_space_complexity: Cell::default(),
96+
max_complexity: Cell::new(std::f64::INFINITY),
97+
search_space_complexity: Cell::new(std::f64::INFINITY),
9898
has_inherent_complexity: true,
9999
inherent_complexity: Cell::default(),
100100
_phantom: PhantomData,
@@ -255,11 +255,12 @@ impl<T: Clone + 'static, M: Mutator<T>> Mutator<Vec<T>> for FixedLenVecMutator<T
255255
#[no_coverage]
256256
|cplx, m| cplx + m.global_search_space_complexity(),
257257
);
258-
self.initialized.set(true);
259258
self.inherent_complexity.set(inherent_complexity);
260259
self.min_complexity.set(min_complexity);
261260
self.max_complexity.set(max_complexity);
262261
self.search_space_complexity.set(search_space_complexity);
262+
263+
self.initialized.set(true);
263264
}
264265

265266
#[doc(hidden)]
@@ -363,6 +364,7 @@ impl<T: Clone + 'static, M: Mutator<T>> Mutator<Vec<T>> for FixedLenVecMutator<T
363364
#[doc(hidden)]
364365
#[no_coverage]
365366
fn random_arbitrary(&self, max_cplx: f64) -> (Vec<T>, f64) {
367+
assert!(self.initialized.get());
366368
let target_cplx = crate::mutators::gen_f64(&self.rng, 1.0..max_cplx);
367369
let (v, sum_cplx) = self.new_input_with_complexity(target_cplx);
368370
(v, sum_cplx + self.inherent_complexity.get())

0 commit comments

Comments
 (0)