Changeset 14834 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests
- Timestamp:
- 04/10/17 00:27:31 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Benchmark/ProblemTests.cs
r14777 r14834 11 11 using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions; 12 12 using HeuristicLab.Problems.ProgramSynthesis.Push.Generators; 13 using HeuristicLab.Problems.ProgramSynthesis.Push.Generators.CodeGenerator; 13 14 using HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter; 14 15 using HeuristicLab.Problems.ProgramSynthesis.Push.Stack; … … 218 219 } 219 220 220 private static double GetDiff<T>(IReadOnlyList<T> estimated, I Stack<T> resultStack)221 private static double GetDiff<T>(IReadOnlyList<T> estimated, IPushStack<T> resultStack) 221 222 where T : IComparable { 222 223 var count = Math.Min(estimated.Count, resultStack.Count); -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/BooleanExpressionTests.cs
r14727 r14834 15 15 } 16 16 17 protected override I Stack<bool> Stack17 protected override IPushStack<bool> Stack 18 18 { 19 19 get -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CodeExpressionTests.cs
r14733 r14834 16 16 } 17 17 18 protected override I Stack<Expression> Stack18 protected override IPushStack<Expression> Stack 19 19 { 20 20 get -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/CommonTests.cs
r14727 r14834 10 10 protected abstract string TypeName { get; } 11 11 12 protected abstract I Stack<T> Stack { get; }12 protected abstract IPushStack<T> Stack { get; } 13 13 14 14 protected abstract T[] GetValues(int count); -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/ExecExpressionTests.cs
r14733 r14834 16 16 } 17 17 18 protected override I Stack<Expression> Stack18 protected override IPushStack<Expression> Stack 19 19 { 20 20 get … … 25 25 26 26 protected override void Test(Expression expression) { 27 this.interpreter.RunAsync(expression, true).Wait(); 27 this.interpreter.Run(expression, true); 28 this.interpreter.Step(); 28 29 } 29 30 … … 61 62 var third = PushParser.Parse("C"); 62 63 63 this.interpreter.ExecStack.Push(third, second, first);64 this.Test(new ExecKExpression());64 interpreter.ExecStack.Push(third, second, first); 65 Test(new ExecKExpression()); 65 66 66 Assert.AreEqual(first, this.interpreter.ExecStack.Top);67 Assert.AreEqual(third, this.interpreter.ExecStack.Bottom);68 this.TestStackCounts(2);67 Assert.AreEqual(first, interpreter.ExecStack.Top); 68 Assert.AreEqual(third, interpreter.ExecStack.Bottom); 69 TestStackCounts(2); 69 70 } 70 71 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/FloatExpressionTests.cs
r14727 r14834 21 21 } 22 22 23 protected override I Stack<double> Stack23 protected override IPushStack<double> Stack 24 24 { 25 25 get -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/IntegerExpressionTests.cs
r14727 r14834 17 17 } 18 18 19 protected override I Stack<long> Stack19 protected override IPushStack<long> Stack 20 20 { 21 21 get -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Tests/Interpreter/Expressions/NameExpressionTests.cs
r14727 r14834 1 namespace HeuristicLab.Tests.Interpreter.Expressions 2 { 1 namespace HeuristicLab.Tests.Interpreter.Expressions { 3 2 using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions; 4 3 using HeuristicLab.Problems.ProgramSynthesis.Push.Generators; … … 8 7 9 8 [TestClass] 10 public class NameExpressionTests : CommonTests<string> 11 { 9 public class NameExpressionTests : CommonTests<string> { 12 10 protected override string TypeName 13 11 { … … 18 16 } 19 17 20 protected override I Stack<string> Stack18 protected override IPushStack<string> Stack 21 19 { 22 20 get … … 30 28 [TestCategory("ExpressionTest")] 31 29 [TestCategory("NameExpressionTest")] 32 public void TestRand() 33 {30 public void TestRand() { 31 this.interpreter.Configuration.ErcOptions.NameErcOptions.IsEnabled = true; 34 32 this.interpreter.Run(new NameRandExpression()); 35 33 … … 43 41 [TestCategory("ExpressionTest")] 44 42 [TestCategory("NameExpressionTest")] 45 public void TestRandomBound() 46 { 43 public void TestRandomBound() { 47 44 this.interpreter.CustomExpressions.Add("c1", new CodeNoopExpression()); 48 45 this.interpreter.CustomExpressions.Add("c2", new CodeNoopExpression()); … … 60 57 [TestCategory("ExpressionTest")] 61 58 [TestCategory("NameExpressionTest")] 62 public void TestRandomBoundWithInsufficientArguments() 63 { 59 public void TestRandomBoundWithInsufficientArguments() { 64 60 this.TestWithInsufficientArguments("RANDBOUNDNAME"); 65 61 } … … 69 65 [TestCategory("ExpressionTest")] 70 66 [TestCategory("NameExpressionTest")] 71 public void TestQuote() 72 { 67 public void TestQuote() { 73 68 this.interpreter.Run(new NameQuoteExpression()); 74 69 … … 78 73 } 79 74 80 protected override string[] GetValues(int count) 81 { 82 var ng = new NameGenerator(); 75 protected override string[] GetValues(int count) { 76 var ng = new StringGenerator(); 83 77 var values = new string[count]; 84 78 … … 88 82 } 89 83 90 protected override void CheckOtherStacksAreEmpty() 91 { 84 protected override void CheckOtherStacksAreEmpty() { 92 85 this.TestStackCounts(nameStack: null); 93 86 }
Note: See TracChangeset
for help on using the changeset viewer.