Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Tests/Interpreter/Expressions/BooleanVectorExpressionsTests.cs @ 17432

Last change on this file since 17432 was 15771, checked in by bburlacu, 7 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

File size: 1.2 KB
Line 
1using System.Collections.Generic;
2using System.Linq;
3using HeuristicLab.Problems.ProgramSynthesis;
4
5namespace HeuristicLab.Tests.Interpreter.Expressions {
6
7  using Microsoft.VisualStudio.TestTools.UnitTesting;
8
9  [TestClass]
10  public class BooleanVectorExpressionsTests : VectorExpressionTests<bool> {
11    protected override string TypeName { get { return "BOOLEAN[]"; } }
12
13    protected override IPushStack<IReadOnlyList<bool>> Stack { get { return interpreter.BooleanVectorStack; } }
14    protected override IPushStack<bool> LiteralStack { get { return interpreter.BooleanStack; } }
15
16    protected override IReadOnlyList<bool>[] GetValues(int count) {
17      return Enumerable
18        .Range(0, count)
19        .Select(x => GetLiterals(interpreter.Configuration.MaxVectorLength / 2 - 1))
20        .ToArray();
21    }
22
23    protected override IReadOnlyList<bool> GetLiterals(int count) {
24      return Enumerable
25        .Range(0, count)
26        .Select(x => interpreter.Configuration.ErcOptions.BooleanErcOptions.GetErcValue(interpreter.Random))
27        .ToArray();
28    }
29
30    protected override void CheckOtherStacksAreEmpty() {
31      TestStackCounts(booleanVectorStack: null);
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.