using HeuristicLab.Algorithms.PushGP.Interpreter; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace HeuristicLab.Tests.Interpreter { public class InterpreterTest { protected PushGPInterpreter interpreter; [TestInitialize] public void BeforeTest() { interpreter = new PushGPInterpreter(new Configuration { TopLevelPushCode = false }); } protected void TestStackCounts(int? execStack = 0, int? codeStack = 0, int? nameStack = 0, int? booleanStack = 0, int? floatStack = 0, int? integerStack = 0) { if (execStack.HasValue) { Assert.AreEqual(execStack, interpreter.ExecStack.Count); } if (codeStack.HasValue) { Assert.AreEqual(codeStack, interpreter.CodeStack.Count); } if (nameStack.HasValue) { Assert.AreEqual(nameStack, interpreter.NameStack.Count); } if (booleanStack.HasValue) { Assert.AreEqual(booleanStack, interpreter.BooleanStack.Count); } if (floatStack.HasValue) { Assert.AreEqual(floatStack, interpreter.FloatStack.Count); } if (integerStack.HasValue) { Assert.AreEqual(integerStack, interpreter.IntegerStack.Count); } } } }