Changeset 14277 for branches/symbreg-factors-2650/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersMatrixTest.cs
- Timestamp:
- 09/08/16 11:41:45 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersMatrixTest.cs
r14276 r14277 27 27 public class IGraphWrappersMatrixTest { 28 28 [TestMethod] 29 public void IGraphWrappersMatrixConstructionAndFinalization() { 29 [TestCategory("ExtLibs")] 30 [TestCategory("ExtLibs.igraph")] 31 [TestProperty("Time", "short")] 32 public void IGraphWrappersMatrixConstructionAndFinalizationTest() { 30 33 var matrix = new Matrix(3, 2); 31 34 Assert.AreEqual(3, matrix.Rows); … … 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("ExtLibs.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("ExtLibs.igraph")] 87 [TestProperty("Time", "short")] 88 public void IGraphWrappersMatrixFillTest() { 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("ExtLibs.igraph")] 102 [TestProperty("Time", "short")] 103 public void IGraphWrappersMatrixTransposeTest() { 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("ExtLibs.igraph")] 113 [TestProperty("Time", "short")] 114 public void IGraphWrappersMatrixScaleTest() { 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 }
Note: See TracChangeset
for help on using the changeset viewer.