using MathEngine.Parser.Tokeniser; using MathEngine.Parser.Parser; namespace EngineTests { /// /// Class for testing the TreeNode class /// [TestClass] public class TreeNodeTests { /// /// Test to see if a simple expression is constructed correctly /// [TestMethod] public void TestTreeNodexpression() { string testExp = "3+4"; TreeNode exptectedTree = new(Token.Plus); Token tokfour = new("4", Token.Type.Numeric, Token.NumericType.Decimal, 0); Token tokthree = new("3", Token.Type.Numeric, Token.NumericType.Decimal, 0); TreeNode four = new(tokfour); TreeNode three = new(tokthree); exptectedTree.AddChildNode(four); exptectedTree.AddChildNode(three); ExpressionTree returnedTree = new (testExp); Assert.IsTrue(exptectedTree.Equals(returnedTree)); } } }