Fix up bisect every which way

This commit is contained in:
2025-03-16 22:37:36 +01:00
parent 9192e68bd3
commit 70198ff293
2 changed files with 28 additions and 2 deletions

View File

@@ -116,6 +116,29 @@ void main() {
result = troubleshooter.binaryBackward();
expect(result.activeMods.length, equals(2));
result = troubleshooter.binaryBackward();
expect(result.activeMods.length, equals(1));
},
);
test(
'Bisect search should end up with half the mods every iteration until 1',
() {
final troubleshooter = ModListTroubleshooter(modList);
var result = troubleshooter.binaryBackward();
// Half of our initial 30
expect(result.activeMods.length, equals(15));
result = troubleshooter.binaryForward();
// Half of our previous result
expect(result.activeMods.length, equals(8));
result = troubleshooter.binaryBackward();
expect(result.activeMods.length, equals(4));
result = troubleshooter.binaryForward();
expect(result.activeMods.length, equals(2));
result = troubleshooter.binaryBackward();
expect(result.activeMods.length, equals(1));
},