Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/InterpreterTest.cs @ 14733

Last change on this file since 14733 was 14727, checked in by pkimmesw, 8 years ago

#2665 PushGP HL Integration, Views, Parameters

File size: 1.5 KB
Line 
1using HeuristicLab.Algorithms.PushGP.Interpreter;
2using Microsoft.VisualStudio.TestTools.UnitTesting;
3
4namespace HeuristicLab.Tests.Interpreter
5{
6    public class InterpreterTest
7    {
8        protected PushGPInterpreter interpreter;
9
10        [TestInitialize]
11        public void BeforeTest()
12        {
13            interpreter = new PushGPInterpreter(new Configuration
14            {
15                TopLevelPushCode = false
16            });
17        }
18
19        protected void TestStackCounts(int? execStack = 0, int? codeStack = 0, int? nameStack = 0, int? booleanStack = 0, int? floatStack = 0, int? integerStack = 0)
20        {
21            if (execStack.HasValue)
22            {
23                Assert.AreEqual(execStack, interpreter.ExecStack.Count);
24            }
25
26            if (codeStack.HasValue)
27            {
28                Assert.AreEqual(codeStack, interpreter.CodeStack.Count);
29            }
30
31            if (nameStack.HasValue)
32            {
33                Assert.AreEqual(nameStack, interpreter.NameStack.Count);
34            }
35
36            if (booleanStack.HasValue)
37            {
38                Assert.AreEqual(booleanStack, interpreter.BooleanStack.Count);
39            }
40
41            if (floatStack.HasValue)
42            {
43                Assert.AreEqual(floatStack, interpreter.FloatStack.Count);
44            }
45
46            if (integerStack.HasValue)
47            {
48                Assert.AreEqual(integerStack, interpreter.IntegerStack.Count);
49            }
50        }
51    }
52}
Note: See TracBrowser for help on using the repository browser.