Last change
on this file since 16752 was
15771,
checked in by bburlacu, 7 years ago
|
#2895: Add solution skeleton for PushGP with genealogy analysis.
|
File size:
1.3 KB
|
Line | |
---|
1 | using HeuristicLab.Problems.ProgramSynthesis;
|
---|
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Tests.Interpreter.Expressions {
|
---|
5 | [TestClass]
|
---|
6 | public class PushProgramTests : ExpressionTest {
|
---|
7 | [TestMethod]
|
---|
8 | [TestProperty("Time", "Short")]
|
---|
9 | [TestCategory("ExpressionTest")]
|
---|
10 | [TestCategory("PushProgramTests")]
|
---|
11 | public void TotalCountTest() {
|
---|
12 | var program = PushParser.ParseProgram("( 5 ( INTEGER.DUP FLOAT.+ FLOAT.- ) ( EXEC.DO ( EXEC.IF ) EXEC.Y ) INTEGER.+ )");
|
---|
13 |
|
---|
14 | Assert.AreEqual(12, program.TotalCount);
|
---|
15 | }
|
---|
16 |
|
---|
17 | [TestMethod]
|
---|
18 | [TestProperty("Time", "Short")]
|
---|
19 | [TestCategory("ExpressionTest")]
|
---|
20 | [TestCategory("PushProgramTests")]
|
---|
21 | public void DepthTest() {
|
---|
22 | var program = PushParser.ParseProgram("( 5 ( INTEGER.DUP FLOAT.+ FLOAT.- ) ( EXEC.DO ( EXEC.IF ) EXEC.Y ) INTEGER.+ )");
|
---|
23 |
|
---|
24 | Assert.AreEqual(3, program.Depth);
|
---|
25 | }
|
---|
26 |
|
---|
27 | [TestMethod]
|
---|
28 | [TestProperty("Time", "Short")]
|
---|
29 | [TestCategory("ExpressionTest")]
|
---|
30 | [TestCategory("PushProgramTests")]
|
---|
31 | public void BranchesTest() {
|
---|
32 | var program = PushParser.ParseProgram("( 5 ( INTEGER.DUP FLOAT.+ FLOAT.- ) ( EXEC.DO ( EXEC.IF ) EXEC.Y ) INTEGER.+ )");
|
---|
33 |
|
---|
34 | Assert.AreEqual(4, program.Branches);
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.