Permalink
Browse files

Four4Sample - support 3 3's

  • Loading branch information...
bobbymcr committed Mar 17, 2018
1 parent b894854 commit c23ec7d27c06c7bfd847690edc056018258f5c6c
@@ -44,6 +44,21 @@ public void OneOperandAndOneBinaryOperator()
TestSearch(search, Expected);
}
[Fact]
public void OneOperandAndOneBinaryOperator3()
{
const string Expected = @"3
3 3 +
3 3 + 3 +
3 3 3 + +";
ExpressionSearch search = new ExpressionSearch { NumeralCount = 3 };
search.AddOperand("3");
search.AddOperator("+");
TestSearch(search, Expected);
}
[Fact]
public void OneOperandAndOneUnaryOperator()
{
@@ -16,8 +16,11 @@ public ExpressionSearch()
{
this.operands = new List<string>();
this.operators = new List<string>();
this.NumeralCount = 4;
}
public int NumeralCount { get; set; }
public void AddOperand(string op)
{
this.operands.Add(op);
@@ -56,7 +59,7 @@ private bool Run(Expression expr, Func<Expression, bool> each)
}
}
if (expr.NumeralCount < 4)
if (expr.NumeralCount < this.NumeralCount)
{
foreach (string op in this.operands)
{

0 comments on commit c23ec7d

Please sign in to comment.