Changeset 14245 for trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph
- Timestamp:
- 08/08/16 23:36:49 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphLayoutTest.cs
r14244 r14245 29 29 public class IGraphLayoutTest { 30 30 [TestMethod] 31 public void TestFruchtermanReingold() { 31 [TestCategory("ExtLibs")] 32 [TestCategory("igraph")] 33 [TestProperty("Time", "short")] 34 public void FruchtermanReingoldLayoutTest() { 32 35 var graph = new Graph(5, new[] { 33 36 Tuple.Create(0, 1), -
trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersGraphTest.cs
r14244 r14245 29 29 public class IGraphWrappersGraphTest { 30 30 [TestMethod] 31 [TestCategory("ExtLibs")] 32 [TestCategory("igraph")] 33 [TestProperty("Time", "short")] 31 34 public void IGraphWrappersGraphConstructionAndFinalization() { 32 35 var graph = new Graph(5, new[] { … … 51 54 52 55 [TestMethod] 56 [TestCategory("ExtLibs")] 57 [TestCategory("igraph")] 58 [TestProperty("Time", "short")] 53 59 public void TestDensity() { 54 60 var graph = new Graph(5, new[] { … … 82 88 83 89 [TestMethod] 90 [TestCategory("ExtLibs")] 91 [TestCategory("igraph")] 92 [TestProperty("Time", "short")] 84 93 public void TestPageRank() { 85 94 var graph = new Graph(4, new[] { -
trunk/sources/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersMatrixTest.cs
r14244 r14245 27 27 public class IGraphWrappersMatrixTest { 28 28 [TestMethod] 29 [TestCategory("ExtLibs")] 30 [TestCategory("igraph")] 31 [TestProperty("Time", "short")] 29 32 public void IGraphWrappersMatrixConstructionAndFinalization() { 30 33 var matrix = new Matrix(3, 2); … … 37 40 Assert.AreEqual(2, other.Columns); 38 41 Assert.AreEqual(4, other[0, 0]); 42 43 var mat = new double[,] { 44 { 1, 2, 3 }, 45 { 4, 5, 6} 46 }; 47 matrix = new Matrix(mat); 48 Assert.AreEqual(2, matrix.Rows); 49 Assert.AreEqual(3, matrix.Columns); 50 var test = matrix.ToMatrix(); 51 for (var i = 0; i < matrix.Rows; i++) 52 for (var j = 0; j < matrix.Columns; j++) { 53 Assert.AreEqual(mat[i, j], matrix[i, j]); 54 Assert.AreEqual(mat[i, j], test[i, j]); 55 } 39 56 } 40 57 41 58 [TestMethod] 59 [TestCategory("ExtLibs")] 60 [TestCategory("igraph")] 61 [TestProperty("Time", "short")] 42 62 public void IGraphWrappersMatrixGetSetTest() { 43 63 var matrix = new Matrix(3, 2); … … 61 81 Assert.AreEqual(matrix[i, j], netmat[i, j]); 62 82 } 83 84 [TestMethod] 85 [TestCategory("ExtLibs")] 86 [TestCategory("igraph")] 87 [TestProperty("Time", "short")] 88 public void IGraphWrappersMatrixFill() { 89 var matrix = new Matrix(3, 2); 90 matrix.Fill(2.6); 91 Assert.AreEqual(2.6, matrix[0, 0]); 92 Assert.AreEqual(2.6, matrix[0, 1]); 93 Assert.AreEqual(2.6, matrix[1, 0]); 94 Assert.AreEqual(2.6, matrix[1, 1]); 95 Assert.AreEqual(2.6, matrix[2, 0]); 96 Assert.AreEqual(2.6, matrix[2, 1]); 97 } 98 99 [TestMethod] 100 [TestCategory("ExtLibs")] 101 [TestCategory("igraph")] 102 [TestProperty("Time", "short")] 103 public void IGraphWrappersMatrixTranspose() { 104 var matrix = new Matrix(3, 2); 105 matrix.Transpose(); 106 Assert.AreEqual(2, matrix.Rows); 107 Assert.AreEqual(3, matrix.Columns); 108 } 109 110 [TestMethod] 111 [TestCategory("ExtLibs")] 112 [TestCategory("igraph")] 113 [TestProperty("Time", "short")] 114 public void IGraphWrappersMatrixScale() { 115 var matrix = new Matrix(3, 2); 116 matrix[0, 0] = matrix[0, 1] = 4; 117 matrix[1, 0] = 3; 118 matrix[1, 1] = 2; 119 matrix[2, 0] = 1.5; 120 matrix[2, 1] = -0.5; 121 matrix.Scale(2); 122 Assert.AreEqual(8, matrix[0, 0]); 123 Assert.AreEqual(8, matrix[0, 1]); 124 Assert.AreEqual(6, matrix[1, 0]); 125 Assert.AreEqual(4, matrix[1, 1]); 126 Assert.AreEqual(3, matrix[2, 0]); 127 Assert.AreEqual(-1, matrix[2, 1]); 128 } 63 129 } 64 130 } -
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.