Skip to content

Commit fbffd75

Browse files
committed
Matrix test update
1 parent 5ee5bf7 commit fbffd75

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Core/Algorithms/DataIO/Tests/ReadMatrixTests.cc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ TEST(ReadMatrixAlgorithmTest, TestSparseFromRealASCIIMatFile)
104104

105105
auto sp = matrix_cast::as_sparse(matrix);
106106

107-
DenseMatrix a(2, 3);
108-
a << 1, 0, 3.5,
109-
-1, 2, 0;
107+
DenseMatrix a(3, 4);
108+
a << 1, 0, 0, -1,
109+
0, 2, 0, 0,
110+
0, 0, 3, 0;
110111

111112
EXPECT_EQ(a, *matrix_convert::to_dense(matrix));
112113
#if !DEBUG
@@ -128,11 +129,11 @@ TEST(ReadMatrixAlgorithmTest, TestDenseFromRealASCIIMatFile)
128129
ASSERT_TRUE(matrix_is::dense(matrix));
129130

130131
auto dense = matrix_cast::as_dense(matrix);
131-
EXPECT_EQ(1, dense->cols());
132-
EXPECT_EQ(428931, dense->rows());
133-
EXPECT_NEAR(-7.86543, dense->minCoeff(), 1e-4);
134-
EXPECT_NEAR(8.90886, dense->maxCoeff(), 1e-4);
135-
EXPECT_DOUBLE_EQ(-0.346299309398506, (*dense)(0,0));
132+
EXPECT_EQ(4, dense->cols());
133+
EXPECT_EQ(3, dense->rows());
134+
EXPECT_NEAR(-1, dense->minCoeff(), 1e-12);
135+
EXPECT_NEAR(3, dense->maxCoeff(), 1e-12);
136+
EXPECT_DOUBLE_EQ(1, (*dense)(0,0));
136137
}
137138
else
138139
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
@@ -150,10 +151,10 @@ TEST(ReadMatrixAlgorithmTest, TestColumnFromRealASCIIMatFile)
150151

151152
auto col = matrix_cast::as_column(matrix);
152153
EXPECT_EQ(1, col->cols());
153-
EXPECT_EQ(428931, col->rows());
154-
EXPECT_NEAR(-7.86543, col->minCoeff(), 1e-4);
155-
EXPECT_NEAR(8.90886, col->maxCoeff(), 1e-4);
156-
EXPECT_DOUBLE_EQ(-0.346299309398506, (*col)(0,0));
154+
EXPECT_EQ(5, col->rows());
155+
EXPECT_NEAR(-4, col->minCoeff(), 1e-12);
156+
EXPECT_NEAR(3, col->maxCoeff(), 1e-12);
157+
EXPECT_DOUBLE_EQ(1, (*col)[0]);
157158
}
158159
else
159160
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;

0 commit comments

Comments
 (0)