WIP: one scratch App for the width guard (improvise-b9f2)
This commit is contained in:
@@ -61,13 +61,12 @@ fn one_coordinate_drills(model: &Model) -> Vec<Vec<String>> {
|
||||
drills
|
||||
}
|
||||
|
||||
/// Records a compared drill's own effects freeze in a fresh `App`, counted only when
|
||||
/// the drill narrowed the store: a whole-store drill never reads the index.
|
||||
fn records_narrowed(effects: Vec<Box<dyn Effect>>) -> usize {
|
||||
let mut app = fixture();
|
||||
let store = app.model_state.workbook.model.data.live_records().count();
|
||||
app.apply_effects(effects);
|
||||
let frozen = app.drill_state.map_or(0, |drill| drill.records.len());
|
||||
/// Records a compared drill's own effects freeze in `scratch`, counted only when the
|
||||
/// drill narrowed the store: a whole-store drill never reads the index.
|
||||
fn records_narrowed(scratch: &mut App, effects: Vec<Box<dyn Effect>>) -> usize {
|
||||
let store = scratch.model_state.workbook.model.data.live_records().count();
|
||||
scratch.apply_effects(effects);
|
||||
let frozen = scratch.drill_state.as_ref().map_or(0, |drill| drill.records.len());
|
||||
if frozen < store { frozen } else { 0 }
|
||||
}
|
||||
|
||||
@@ -116,6 +115,7 @@ fn compare(a: &CmdContext, others: &[CmdContext]) -> Comparison {
|
||||
let drill = DrillIntoCell {
|
||||
key: CellKey::new(vec![]),
|
||||
};
|
||||
let mut scratch = fixture();
|
||||
for name in a.registry.names().collect::<Vec<_>>() {
|
||||
let before = found.compared;
|
||||
for args in &candidates {
|
||||
@@ -124,7 +124,7 @@ fn compare(a: &CmdContext, others: &[CmdContext]) -> Comparison {
|
||||
};
|
||||
let left = format!("{effects:?}");
|
||||
if name == drill.name() {
|
||||
found.widest_drill = found.widest_drill.max(records_narrowed(effects));
|
||||
found.widest_drill = found.widest_drill.max(records_narrowed(&mut scratch, effects));
|
||||
}
|
||||
found.compared += 1;
|
||||
for b in others {
|
||||
|
||||
Reference in New Issue
Block a user