Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/PushProgramTests.cs @ 15822

Last change on this file since 15822 was 15017, checked in by pkimmesw, 7 years ago

#2665 Fixed Benchmark Problem Definition, Converted LoopExpressions to stateless expressions, Added several unit test to ensure funcionality, Fixed UI bugs

File size: 1.3 KB
Line 
1namespace HeuristicLab.Tests.Interpreter.Expressions {
2  using HeuristicLab.Problems.ProgramSynthesis.Push.Parser;
3
4  using Microsoft.VisualStudio.TestTools.UnitTesting;
5
6  [TestClass]
7  public class PushProgramTests : ExpressionTest {
8    [TestMethod]
9    [TestProperty("Time", "Short")]
10    [TestCategory("ExpressionTest")]
11    [TestCategory("PushProgramTests")]
12    public void TotalCountTest() {
13      var program = PushParser.ParseProgram("( 5 ( INTEGER.DUP FLOAT.+ FLOAT.- ) ( EXEC.DO ( EXEC.IF ) EXEC.Y ) INTEGER.+ )");
14
15      Assert.AreEqual(12, program.TotalCount);
16    }
17
18    [TestMethod]
19    [TestProperty("Time", "Short")]
20    [TestCategory("ExpressionTest")]
21    [TestCategory("PushProgramTests")]
22    public void DepthTest() {
23      var program = PushParser.ParseProgram("( 5 ( INTEGER.DUP FLOAT.+ FLOAT.- ) ( EXEC.DO ( EXEC.IF ) EXEC.Y ) INTEGER.+ )");
24
25      Assert.AreEqual(3, program.Depth);
26    }
27
28    [TestMethod]
29    [TestProperty("Time", "Short")]
30    [TestCategory("ExpressionTest")]
31    [TestCategory("PushProgramTests")]
32    public void BranchesTest() {
33      var program = PushParser.ParseProgram("( 5 ( INTEGER.DUP FLOAT.+ FLOAT.- ) ( EXEC.DO ( EXEC.IF ) EXEC.Y ) INTEGER.+ )");
34
35      Assert.AreEqual(4, program.Branches);
36    }
37  }
38}
Note: See TracBrowser for help on using the repository browser.