Skip to content

Commit

Permalink
Fixed last test
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi committed Mar 4, 2012
1 parent ff1141a commit 4f1fccd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void Can_Process_Multiple_Variables()
var a = 6;
var b = 4.32m;
var c = 24.15m;
Assert.That(engine.Evaluate("(((9-6/2)*2-4.32)/2-6-1)/(2+24.15/(2+4))"), Is.EqualTo((((9 - a / 2) * 2 - b) / 2m - a - 1) / (2 + c / (2 + 4))));
Assert.That(engine.Evaluate("(((9-a/2)*2-b)/2-a-1)/(2+c/(2+4))", a, b, c), Is.EqualTo((((9 - a / 2) * 2 - b) / 2 - a - 1) / (2 + c / (2 + 4))));
}
}
}
6 changes: 5 additions & 1 deletion SimpleExpressionEvaluator/ExpressionEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ public decimal Evaluate(string expression, params decimal[] arguments)
continue;
}

if (next != ' ')
if (next == ' ')
{
reader.Read();
}
else
{
throw new ArgumentException(string.Format("Encountered invalid character {0}", next),
"expression");
Expand Down

0 comments on commit 4f1fccd

Please sign in to comment.