Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/08/16 11:41:45 (8 years ago)
Author:
gkronber
Message:

#2650: merged r14245:14273 from trunk to branch (fixing conflicts in RegressionSolutionTargetResponseGradientView)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650/HeuristicLab.Tests/HeuristicLab.IGraph/IGraphWrappersMatrixTest.cs

    r14276 r14277  
    2727  public class IGraphWrappersMatrixTest {
    2828    [TestMethod]
    29     public void IGraphWrappersMatrixConstructionAndFinalization() {
     29    [TestCategory("ExtLibs")]
     30    [TestCategory("ExtLibs.igraph")]
     31    [TestProperty("Time", "short")]
     32    public void IGraphWrappersMatrixConstructionAndFinalizationTest() {
    3033      var matrix = new Matrix(3, 2);
    3134      Assert.AreEqual(3, matrix.Rows);
     
    3740      Assert.AreEqual(2, other.Columns);
    3841      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        }
    3956    }
    4057
    4158    [TestMethod]
     59    [TestCategory("ExtLibs")]
     60    [TestCategory("ExtLibs.igraph")]
     61    [TestProperty("Time", "short")]
    4262    public void IGraphWrappersMatrixGetSetTest() {
    4363      var matrix = new Matrix(3, 2);
     
    6181          Assert.AreEqual(matrix[i, j], netmat[i, j]);
    6282    }
     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    }
    63129  }
    64130}
Note: See TracChangeset for help on using the changeset viewer.