use crate::graph::{
feature::{FeatureGraph, FeatureId, FeatureSet},
fixedbitset_strategy,
};
use petgraph::prelude::*;
use proptest::prelude::*;
impl<'g> FeatureGraph<'g> {
pub fn proptest1_id_strategy(&self) -> impl Strategy<Value = FeatureId<'g>> + 'g + use<'g> {
let dep_graph = self.dep_graph();
let package_graph = self.package_graph;
any::<prop::sample::Index>().prop_map(move |index| {
let feature_ix = NodeIndex::new(index.index(dep_graph.node_count()));
FeatureId::from_node(package_graph, &dep_graph[feature_ix])
})
}
pub fn proptest1_set_strategy(&self) -> impl Strategy<Value = FeatureSet<'g>> + 'g + use<'g> {
let this = *self;
fixedbitset_strategy(self.feature_count())
.prop_map(move |included| FeatureSet::from_included(this, included))
}
}