Line | |
---|
1 | namespace HeuristicLab.Tests.Interpreter {
|
---|
2 | using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration;
|
---|
3 | using HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter;
|
---|
4 |
|
---|
5 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
6 |
|
---|
7 | public class ExpressionTest {
|
---|
8 | protected PushGpInterpreter interpreter;
|
---|
9 |
|
---|
10 | protected PushGpConfiguration configuration = new PushGpConfiguration { TopLevelPushCode = false };
|
---|
11 |
|
---|
12 | [TestInitialize]
|
---|
13 | public void BeforeTest() {
|
---|
14 | this.interpreter = new PushGpInterpreter(configuration);
|
---|
15 | }
|
---|
16 |
|
---|
17 | protected void TestStackCounts(
|
---|
18 | int? execStack = 0,
|
---|
19 | int? codeStack = 0,
|
---|
20 | int? nameStack = 0,
|
---|
21 | int? booleanStack = 0,
|
---|
22 | int? floatStack = 0,
|
---|
23 | int? integerStack = 0) {
|
---|
24 | if (execStack.HasValue) Assert.AreEqual(execStack, this.interpreter.ExecStack.Count);
|
---|
25 |
|
---|
26 | if (codeStack.HasValue) Assert.AreEqual(codeStack, this.interpreter.CodeStack.Count);
|
---|
27 |
|
---|
28 | if (nameStack.HasValue) Assert.AreEqual(nameStack, this.interpreter.NameStack.Count);
|
---|
29 |
|
---|
30 | if (booleanStack.HasValue) Assert.AreEqual(booleanStack, this.interpreter.BooleanStack.Count);
|
---|
31 |
|
---|
32 | if (floatStack.HasValue) Assert.AreEqual(floatStack, this.interpreter.FloatStack.Count);
|
---|
33 |
|
---|
34 | if (integerStack.HasValue) Assert.AreEqual(integerStack, this.interpreter.IntegerStack.Count);
|
---|
35 | }
|
---|
36 | }
|
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.