mirror of
https://github.com/0xJ1M/MathsEngine.git
synced 2026-06-05 02:10:08 +00:00
WIP
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Xunit;
|
||||
|
||||
using MathEngine.AST.Nodes;
|
||||
using MathEngine.Types;
|
||||
|
||||
namespace EngineTests.Parser_Tests.Nodes
|
||||
{
|
||||
@@ -15,8 +16,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeAdd()
|
||||
{
|
||||
NumericNode<decimal> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
BaseNode result = testNode1 + testNode2;
|
||||
Assert.Equal("200", result.ToString());
|
||||
}
|
||||
@@ -27,8 +28,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeAddDifferentTypesRaisesException()
|
||||
{
|
||||
NumericNode<int> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
try
|
||||
{
|
||||
BaseNode result = testNode1 + testNode2;
|
||||
@@ -46,8 +47,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeSubtract()
|
||||
{
|
||||
NumericNode<decimal> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
BaseNode result = testNode1 - testNode2;
|
||||
Assert.Equal("0", result.ToString());
|
||||
}
|
||||
@@ -58,8 +59,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeSubtractDifferentTypesRaisesException()
|
||||
{
|
||||
NumericNode<int> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
try
|
||||
{
|
||||
BaseNode result = testNode1 - testNode2;
|
||||
@@ -77,8 +78,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeMultiply()
|
||||
{
|
||||
NumericNode<decimal> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
BaseNode result = testNode1 * testNode2;
|
||||
Assert.Equal("10000", result.ToString());
|
||||
}
|
||||
@@ -89,8 +90,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeMultiplyDifferentTypesRaisesException()
|
||||
{
|
||||
NumericNode<int> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
try
|
||||
{
|
||||
BaseNode result = testNode1 * testNode2;
|
||||
@@ -108,8 +109,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeDivide()
|
||||
{
|
||||
NumericNode<decimal> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
BaseNode result = testNode1 / testNode2;
|
||||
Assert.Equal("1", result.ToString());
|
||||
}
|
||||
@@ -120,8 +121,8 @@ namespace EngineTests.Parser_Tests.Nodes
|
||||
[Fact]
|
||||
public void TestNumericNodeDividedDifferentTypesRaisesException()
|
||||
{
|
||||
NumericNode<int> testNode1 = new(100);
|
||||
NumericNode<decimal> testNode2 = new(100);
|
||||
NumericNode<DecimalValue> testNode1 = new(new DecimalValue(100));
|
||||
NumericNode<DecimalValue> testNode2 = new(new DecimalValue(100));
|
||||
try
|
||||
{
|
||||
BaseNode result = testNode1 / testNode2;
|
||||
|
||||
Reference in New Issue
Block a user