Permalink
Browse files

Four4Sample - allow more than 100 results

  • Loading branch information...
bobbymcr committed Mar 17, 2018
1 parent 7cfac95 commit 73399b42c7e166ae303b2b62f438b8c05bb73adb
Showing with 14 additions and 1 deletion.
  1. +13 −0 projects/Four4Sample/Four4.Test/AlgorithmTest.cs
  2. +1 −1 projects/Four4Sample/Four4/Algorithm.cs
@@ -40,6 +40,19 @@ public void RunWithOtherDigitAndDifferentMinMax()
output[6].Should().Be("11 = (33/3)");
}
[Fact]
public void RunWithMoreThan100Results()
{
string[] output = Run("4", "2", "102");
output.Should().HaveCount(104);
output[0].Should().Match("Solving 4 4s (min=2, max=102)...");
output[1].Should().Match("Found 101 results in * ms.");
output[2].Should().Be("2 = ((44+4)/(4)!)");
output[101].Should().Be("101 = ((44/.4_)+sqrt(4))");
output[102].Should().Be("102 = ((44+(4)!)/sqrt(.4_))");
}
private static string[] Run(params string[] args)
{
StringBuilder sb = new StringBuilder();
@@ -80,7 +80,7 @@ private static int GetMax(string[] args)
private bool OnFound(Results results, Expression expr)
{
results.Add(expr);
return results.Count < 100;
return results.Count < (this.max - this.min + 1);
}
private ExpressionSearch InitSearch()

0 comments on commit 73399b4

Please sign in to comment.