Changeset 11939 for trunk/sources/HeuristicLab.Tests/HeuristicLab.Algorithms.ParameterlessPopulationPyramid-3.3/EnumerableBoolEqualityComparerTest.cs
- Timestamp:
- 02/06/15 13:28:55 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Tests/HeuristicLab.Algorithms.ParameterlessPopulationPyramid-3.3
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Algorithms.ParameterlessPopulationPyramid-3.3/EnumerableBoolEqualityComparerTest.cs
r11935 r11939 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System.Collections.Generic; 23 using System.Linq; 24 using HeuristicLab.Algorithms.ParameterlessPopulationPyramid; 25 using HeuristicLab.Random; 2 26 using Microsoft.VisualStudio.TestTools.UnitTesting; 3 using HeuristicLab.Random;4 using System.Collections.Generic;5 using HeuristicLab.Algorithms.ParameterlessPopulationPyramid;6 using System.Linq;7 27 8 28 namespace ParameterlessPopulationPyramid.Test { … … 18 38 } 19 39 [TestMethod] 40 [TestProperty("Time", "short")] 41 [TestCategory("Algorithms.ParameterlessPopulationPyramid")] 20 42 public void EnumerableBoolEqualsTest() { 21 43 bool[] array = new bool[10]; … … 23 45 randFill(array, rand); 24 46 Assert.IsTrue(compare.Equals(array, array)); 25 47 26 48 // Clones equal 27 49 var another = (bool[])array.Clone(); 28 50 Assert.IsTrue(compare.Equals(array, another)); 29 51 30 52 // Flipping a bit makes unequal 31 int flip = rand.Next(array.Length -1);53 int flip = rand.Next(array.Length - 1); 32 54 another[flip] = !another[flip]; 33 55 Assert.IsFalse(compare.Equals(array, another)); … … 40 62 41 63 [TestMethod] 64 [TestProperty("Time", "short")] 65 [TestCategory("Algorithms.ParameterlessPopulationPyramid")] 42 66 public void EnumerableBoolHashCollisionTest() { 43 67 int collisions = 0; … … 46 70 randFill(array, rand); 47 71 int original = compare.GetHashCode(array); 48 72 49 73 bool[] another = (bool[])array.Clone(); 50 74 // Perform random walk around string checking for hash collisions … … 70 94 71 95 [TestMethod] 96 [TestProperty("Time", "short")] 97 [TestCategory("Algorithms.ParameterlessPopulationPyramid")] 72 98 public void EnumerableBoolHashSetTest() { 73 99 HashSet<bool[]> set = new HashSet<bool[]>(compare);
Note: See TracChangeset
for help on using the changeset viewer.