Changeset 14245 for trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersVectorTest.cs
- Timestamp:
- 08/08/16 23:36:49 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersVectorTest.cs
r14244 r14245 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.IGraph.Wrappers; 23 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 27 28 public class IGraphWrappersVectorTest { 28 29 [TestMethod] 30 [TestCategory("ExtLibs")] 31 [TestCategory("igraph")] 32 [TestProperty("Time", "short")] 29 33 public void IGraphWrappersVectorConstructionAndFinalization() { 30 34 var vector = new Vector(7); … … 35 39 Assert.AreEqual(7, other.Length); 36 40 Assert.AreEqual(4, other[0]); 41 42 var myvec = new double[] { 1, 2, 3 }; 43 vector = new Vector(myvec); 44 Assert.AreEqual(3, vector.Length); 45 Assert.AreEqual(myvec[0], vector[0]); 46 Assert.AreEqual(myvec[1], vector[1]); 47 Assert.AreEqual(myvec[2], vector[2]); 37 48 } 38 49 39 50 [TestMethod] 51 [TestCategory("ExtLibs")] 52 [TestCategory("igraph")] 53 [TestProperty("Time", "short")] 40 54 public void IGraphWrappersVectorGetSetTest() { 41 55 var vector = new Vector(5); … … 55 69 Assert.AreEqual(vector[i], netmat[i]); 56 70 } 71 72 [TestMethod] 73 [TestCategory("ExtLibs")] 74 [TestCategory("igraph")] 75 [TestProperty("Time", "short")] 76 public void IGraphWrappersVectorFillTest() { 77 var vector = new Vector(5); 78 vector.Fill(2.3); 79 Assert.IsTrue(new[] { 2.3, 2.3, 2.3, 2.3, 2.3 }.SequenceEqual(vector.ToArray())); 80 } 81 82 [TestMethod] 83 [TestCategory("ExtLibs")] 84 [TestCategory("igraph")] 85 [TestProperty("Time", "short")] 86 public void IGraphWrappersVectorReverseTest() { 87 var vector = new Vector(5); 88 vector[0] = vector[1] = 4; 89 vector[2] = 3; 90 vector[3] = 1.5; 91 vector[4] = -0.5; 92 vector.Reverse(); 93 Assert.IsTrue(new[] { -0.5, 1.5, 3, 4, 4 }.SequenceEqual(vector.ToArray())); 94 } 95 96 [TestMethod] 97 [TestCategory("ExtLibs")] 98 [TestCategory("igraph")] 99 [TestProperty("Time", "short")] 100 public void IGraphWrappersVectorShuffleTest() { 101 var vector = new Vector(5); 102 vector[0] = vector[1] = 4; 103 vector[2] = 3; 104 vector[3] = 1.5; 105 vector[4] = -0.5; 106 vector.Shuffle(); 107 Assert.IsFalse(new[] { -0.5, 1.5, 3, 4, 4 }.SequenceEqual(vector.ToArray())); 108 Assert.IsFalse(new[] { 4, 4, 3, 1.5, -0.5 }.SequenceEqual(vector.ToArray())); 109 } 110 111 [TestMethod] 112 [TestCategory("ExtLibs")] 113 [TestCategory("igraph")] 114 [TestProperty("Time", "short")] 115 public void IGraphWrappersVectorScaleTest() { 116 var vector = new Vector(5); 117 vector[0] = vector[1] = 4; 118 vector[2] = 3; 119 vector[3] = 1.5; 120 vector[4] = -0.5; 121 vector.Scale(2); 122 Assert.IsTrue(new double[] { 8, 8, 6, 3, -1 }.SequenceEqual(vector.ToArray())); 123 } 57 124 } 58 125 }
Note: See TracChangeset
for help on using the changeset viewer.