Changeset 11182 for branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/RealVectorSolutionCacheTest.cs
- Timestamp:
- 07/10/14 17:38:08 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/RealVectorSolutionCacheTest.cs
r10105 r11182 29 29 [TestClass] 30 30 public class RealVectorSolutionCacheTest { 31 [TestMethod] 32 public void TestComparer() { 33 var rand = new HeuristicLab.Random.FastRandom(); 34 int nrOfVectors = 500000; 35 int vectorLength = 4; 36 37 RealVectorEqualityComparer comp = new RealVectorEqualityComparer(); 38 39 for (int i = 0; i < nrOfVectors; i++) { 40 RealVector vector1 = new RealVector(vectorLength, rand, -20, 30); 41 RealVector vector2 = new RealVector(vectorLength, rand, -20, 30); 42 RealVector vector3 = SinglePointCrossover.Apply(rand, vector1, vector2); 43 44 bool result = comp.Equals(vector1, vector2); 45 Assert.AreEqual(result, comp.GetHashCode(vector1) == comp.GetHashCode(vector2)); 46 47 result = comp.Equals(vector1, vector3); 48 Assert.AreEqual(result, comp.GetHashCode(vector1) == comp.GetHashCode(vector3)); 49 50 result = comp.Equals(vector3, vector2); 51 Assert.AreEqual(result, comp.GetHashCode(vector3) == comp.GetHashCode(vector2)); 52 53 result = comp.Equals(vector3, vector3); 54 Assert.AreEqual(result, comp.GetHashCode(vector3) == comp.GetHashCode(vector3)); 55 56 57 } 58 } 59 31 60 [TestMethod] 32 61 public void TestCache() {
Note: See TracChangeset
for help on using the changeset viewer.