mirror of
https://github.com/0xJ1M/MathsEngine.git
synced 2026-06-05 02:10:08 +00:00
Major refactor
This commit is contained in:
30
MathEngine/EngineTests/Expression/ExpressionTests.cs
Normal file
30
MathEngine/EngineTests/Expression/ExpressionTests.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Xunit;
|
||||
|
||||
namespace EngineTests.Expression
|
||||
{
|
||||
public class ExpressionTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Test that Evaluate returns valid output
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestTokenizeBasicExpressionEvalutesToCorrectResult()
|
||||
{
|
||||
MathEngine.Expression.Expression test_expression = new("1+1");
|
||||
MathEngine.Expression.Expression expected_result = new("2");
|
||||
Assert.Equivalent(expected_result, test_expression.Evaluate(), true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test that Expression involing all basic operators returns valid reuslt
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestTokenizeBasicExpressionAllOperatorsEvalutesToCorrectResult()
|
||||
{
|
||||
MathEngine.Expression.Expression test_expression = new("1+1-2*3/4");
|
||||
MathEngine.Expression.Expression expected_result = new("0.5");
|
||||
Assert.Equivalent(expected_result, test_expression.Evaluate(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user