1 //! Strategies for `u128` and `i128`, since proptest doesn't provide them for the wasm target.
3 macro_rules! impl_num {
6 type InnerStrategy = crate::array::UniformArrayStrategy<proptest::num::u64::Any, [u64; 2]>;
7 use proptest::strategy::{Strategy, ValueTree, NewTree};
10 #[must_use = "strategies do nothing unless used"]
11 #[derive(Clone, Copy, Debug)]
13 strategy: InnerStrategy,
16 pub struct BinarySearch {
17 inner: <InnerStrategy as Strategy>::Tree,
20 impl ValueTree for BinarySearch {
23 fn current(&self) -> $name {
24 unsafe { core::mem::transmute(self.inner.current()) }
27 fn simplify(&mut self) -> bool {
31 fn complicate(&mut self) -> bool {
32 self.inner.complicate()
36 impl Strategy for Any {
37 type Tree = BinarySearch;
40 fn new_tree(&self, runner: &mut proptest::test_runner::TestRunner) -> NewTree<Self> {
41 Ok(BinarySearch { inner: self.strategy.new_tree(runner)? })
45 pub const ANY: Any = Any { strategy: InnerStrategy::new(proptest::num::u64::ANY) };