Skip to content

Commit e9ad363

Browse files
committed
Paths
1 parent c5d9699 commit e9ad363

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEST(ReadMatrixTests, RoundTripViaString)
7474
TEST(ReadMatrixAlgorithmTest, TestFromRealTextFile)
7575
{
7676
ReadMatrixAlgorithm algo;
77-
auto filename = TestResources::rootDir() / "matrix1.txt";
77+
auto filename = TestResources::rootDir() / "Matrices" / "matrix1.txt";
7878
if (boost::filesystem::exists(filename))
7979
{
8080
DenseMatrixConstHandle matrix = matrix_cast::as_dense(algo.run(filename.string()));
@@ -95,7 +95,7 @@ TEST(ReadMatrixAlgorithmTest, ThrowsForFileNotFound)
9595
TEST(ReadMatrixAlgorithmTest, TestSparseFromRealASCIIMatFile)
9696
{
9797
ReadMatrixAlgorithm algo;
98-
auto filename = TestResources::rootDir() / "sp2.mat";
98+
auto filename = TestResources::rootDir() / "Matrices" / "sp2.mat";
9999
if (boost::filesystem::exists(filename))
100100
{
101101
auto matrix = algo.run(filename.string());
@@ -114,13 +114,13 @@ TEST(ReadMatrixAlgorithmTest, TestSparseFromRealASCIIMatFile)
114114
#endif
115115
}
116116
else
117-
FAIL() << "file does not exist, skipping test." << std::endl;
117+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
118118
}
119119

120120
TEST(ReadMatrixAlgorithmTest, TestDenseFromRealASCIIMatFile)
121121
{
122122
ReadMatrixAlgorithm algo;
123-
auto filename = TestResources::rootDir() / "CGDarrell" / "xScirun.mat";
123+
auto filename = TestResources::rootDir() / "Matrices" / "CGDarrell" / "xScirun.mat";
124124
if (boost::filesystem::exists(filename))
125125
{
126126
auto matrix = algo.run(filename.string());
@@ -135,13 +135,13 @@ TEST(ReadMatrixAlgorithmTest, TestDenseFromRealASCIIMatFile)
135135
EXPECT_DOUBLE_EQ(-0.346299309398506, (*dense)(0,0));
136136
}
137137
else
138-
FAIL() << "file does not exist, skipping test." << std::endl;
138+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
139139
}
140140

141141
TEST(ReadMatrixAlgorithmTest, TestColumnFromRealASCIIMatFile)
142142
{
143143
ReadMatrixAlgorithm algo;
144-
auto filename = TestResources::rootDir() / "CGDarrell" / "xScirunColumn.mat";
144+
auto filename = TestResources::rootDir() / "Matrices" / "CGDarrell" / "xScirunColumn.mat";
145145
if (boost::filesystem::exists(filename))
146146
{
147147
auto matrix = algo.run(filename.string());
@@ -156,13 +156,13 @@ TEST(ReadMatrixAlgorithmTest, TestColumnFromRealASCIIMatFile)
156156
EXPECT_DOUBLE_EQ(-0.346299309398506, (*col)(0,0));
157157
}
158158
else
159-
FAIL() << "file does not exist, skipping test." << std::endl;
159+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
160160
}
161161

162162
TEST(ReadMatrixAlgorithmTest, DISABLED_TestLargeSparseFromRealASCIIMatFile)
163163
{
164164
ReadMatrixAlgorithm algo;
165-
auto AFile = TestResources::rootDir() / "CGDarrell" / "A_txt.mat";
165+
auto AFile = TestResources::rootDir() / "Matrices" / "CGDarrell" / "A_txt.mat";
166166
if (boost::filesystem::exists(AFile))
167167
{
168168
auto matrix = algo.run(AFile.string());
@@ -176,32 +176,32 @@ TEST(ReadMatrixAlgorithmTest, DISABLED_TestLargeSparseFromRealASCIIMatFile)
176176
EXPECT_EQ(5540569, sp->nonZeros());
177177
}
178178
else
179-
std::cout << "file does not exist, skipping test." << std::endl;
179+
FAIL() << "file " << AFile.string() << " does not exist, skipping test." << std::endl;
180180
}
181181

182182
TEST(ReadMatrixAlgorithmTest, UnknownFileFormatThrows)
183183
{
184184
ReadMatrixAlgorithm algo;
185-
auto notAMatrixFile = TestResources::rootDir() / "scirun5demo.srn";
185+
auto notAMatrixFile = TestResources::rootDir() / "scirun5demo.srn";
186186
if (boost::filesystem::exists(notAMatrixFile))
187187
{
188188
EXPECT_THROW(algo.run(notAMatrixFile.string()), Core::Algorithms::AlgorithmInputException);
189189
}
190190
else
191-
FAIL() << "file does not exist, skipping test." << std::endl;
191+
FAIL() << "file " << notAMatrixFile.string() << " does not exist, skipping test." << std::endl;
192192
}
193193

194194
TEST(ReadMatrixAlgorithmTest, DISABLED_ThrowsForMatlabFilesICantThemReadYet)
195195
{
196196
/// @todo: will hook up Matlab readers soon.
197197
ReadMatrixAlgorithm algo;
198-
auto matlabFile = TestResources::rootDir() / "CGDarrell" / "RHS.mat";
198+
auto matlabFile = TestResources::rootDir() / "Matrices" / "CGDarrell" / "RHS.mat";
199199
if (boost::filesystem::exists(matlabFile))
200200
{
201201
EXPECT_THROW(algo.run(matlabFile.string()), Core::Algorithms::AlgorithmInputException);
202202
}
203203
else
204-
FAIL() << "file does not exist, skipping test." << std::endl;
204+
FAIL() << "file " << matlabFile.string() << " does not exist, skipping test." << std::endl;
205205
}
206206

207207
TEST(ReadMatrixAlgorithmTest, DISABLED_NonMatrixTextFile)
@@ -214,13 +214,13 @@ TEST(ReadMatrixAlgorithmTest, DISABLED_NonMatrixTextFile)
214214
EXPECT_THROW(algo.run(txt.string()), Core::Algorithms::AlgorithmInputException);
215215
}
216216
else
217-
FAIL() << "file does not exist, skipping test." << std::endl;
217+
FAIL() << "file " << txt.string() << " does not exist, skipping test." << std::endl;
218218
}
219219

220220
TEST(ReadMatrixAlgorithmTest, TestSparseFromRealBinaryMatFile)
221221
{
222222
ReadMatrixAlgorithm algo;
223-
auto filename = TestResources::rootDir() / "CGDarrell" / "eye3x3sparse_bin.mat";
223+
auto filename = TestResources::rootDir() / "Matrices" / "eye3x3sparse_bin.mat";
224224
if (boost::filesystem::exists(filename))
225225
{
226226
auto matrix = algo.run(filename.string());
@@ -237,13 +237,13 @@ TEST(ReadMatrixAlgorithmTest, TestSparseFromRealBinaryMatFile)
237237
#endif
238238
}
239239
else
240-
FAIL() << "file does not exist, skipping test." << std::endl;
240+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
241241
}
242242

243243
TEST(ReadMatrixAlgorithmTest, TestDenseFromRealBinaryMatFile)
244244
{
245245
ReadMatrixAlgorithm algo;
246-
auto filename = TestResources::rootDir() / "CGDarrell" / "eye3x3dense_bin.mat";
246+
auto filename = TestResources::rootDir() / "Matrices" / "eye3x3dense_bin.mat";
247247
if (boost::filesystem::exists(filename))
248248
{
249249
auto matrix = algo.run(filename.string());
@@ -257,13 +257,13 @@ TEST(ReadMatrixAlgorithmTest, TestDenseFromRealBinaryMatFile)
257257
EXPECT_EQ(to_string(a), to_string(*dense));
258258
}
259259
else
260-
FAIL() << "file does not exist, skipping test." << std::endl;
260+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
261261
}
262262

263263
TEST(ReadMatrixAlgorithmTest, TestColumnFromRealBinaryMatFile)
264264
{
265265
ReadMatrixAlgorithm algo;
266-
auto filename = TestResources::rootDir() / "CGDarrell" / "columnBinMat.mat";
266+
auto filename = TestResources::rootDir() / "Matrices" / "columnBinMat.mat";
267267
if (boost::filesystem::exists(filename))
268268
{
269269
auto matrix = algo.run(filename.string());
@@ -276,18 +276,18 @@ TEST(ReadMatrixAlgorithmTest, TestColumnFromRealBinaryMatFile)
276276
EXPECT_EQ(to_string(*col), to_string(expected));
277277
}
278278
else
279-
FAIL() << "file does not exist, skipping test." << std::endl;
279+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
280280
}
281281

282282
TEST(ReadMatrixAlgorithmTest, TestColumnFromRealBinaryMatFile2)
283283
{
284284
ReadMatrixAlgorithm algo;
285-
auto filename = TestResources::rootDir() / "columnBin2.mat";
285+
auto filename = TestResources::rootDir() / "Matrices" / "columnBin2.mat";
286286
if (boost::filesystem::exists(filename))
287287
{
288288
auto matrix = algo.run(filename.string());
289289
ASSERT_TRUE(matrix.get() != nullptr);
290-
ASSERT_TRUE(matrix_is::column(matrix));
290+
ASSERT_TRUE(matrix_is::column(matrix));
291291

292292
auto col = matrix_cast::as_column(matrix);
293293
DenseColumnMatrix expected(5);
@@ -323,15 +323,15 @@ void CallLegacyPio(const boost::filesystem::path& filename, const DenseMatrix& e
323323
#endif
324324
}
325325
else
326-
FAIL() << "file does not exist, skipping test." << std::endl;
326+
FAIL() << "file " << filename.string() << " does not exist, skipping test." << std::endl;
327327
}
328328

329329
TEST(ReadMatrixAlgorithmTest, CallLegacyPioDense)
330330
{
331-
CallLegacyPio(TestResources::rootDir() / "CGDarrell" / "eye3x3dense_bin.mat");
331+
CallLegacyPio(TestResources::rootDir() / "Matrices" / "eye3x3dense_bin.mat");
332332
}
333333

334334
TEST(ReadMatrixAlgorithmTest, CallLegacyPioSparse)
335335
{
336-
CallLegacyPio(TestResources::rootDir() / "CGDarrell" / "eye3x3sparse_bin.mat");
337-
}
336+
CallLegacyPio(TestResources::rootDir() / "Matrices" / "eye3x3sparse_bin.mat");
337+
}

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ TEST(WriteMatrixTests, CanWriteToStream)
7979
TEST(WriteMatrixAlgorithmTest, TestToRealTextFile)
8080
{
8181
WriteMatrixAlgorithm algo;
82-
auto filename = TestResources::rootDir() / "matrix1Out.txt";
82+
auto filename = TestResources::rootDir() / "TransientOutput" / "matrix1Out.txt";
8383

8484
DenseMatrixHandle m1(matrix1().clone());
8585
algo.run(m1, filename.string());
@@ -88,7 +88,7 @@ TEST(WriteMatrixAlgorithmTest, TestToRealTextFile)
8888
TEST(WriteMatrixAlgorithmTest, RoundTripRealTextFile)
8989
{
9090
WriteMatrixAlgorithm write;
91-
auto filename = TestResources::rootDir() / "matrix1Out.txt";
91+
auto filename = TestResources::rootDir() / "TransientOutput" / "matrix1Out.txt";
9292

9393
DenseMatrixHandle m1(matrix1().clone());
9494
write.run(m1, filename.string());
@@ -103,7 +103,7 @@ TEST(WriteMatrixAlgorithmTest, RoundTripRealTextFile)
103103
TEST(WriteMatrixAlgorithmTest, RoundTripRealBinaryFile)
104104
{
105105
WriteMatrixAlgorithm write;
106-
auto filename = TestResources::rootDir() / "matrix1Out.mat";
106+
auto filename = TestResources::rootDir() / "TransientOutput" / "matrix1Out.mat";
107107

108108
DenseMatrixHandle m1(matrix1().clone());
109109
write.run(m1, filename.string());
@@ -130,7 +130,7 @@ TEST(WriteMatrixAlgorithmTest, CheckBoostExceptionLoggingCapability)
130130
}
131131
catch (boost::exception& e)
132132
{
133-
std::cout << boost::diagnostic_information(e) << std::endl;
133+
std::cout << boost::diagnostic_information(e) << std::endl;
134134
}
135135
}
136136

@@ -149,7 +149,7 @@ TEST(WriteMatrixTest, CanPrintSparseMatrix)
149149
#if !DEBUG
150150
EXPECT_EQ("1 0 0 \n0 0 -1.4 \n0 0 0 \n", ostr.str());
151151
#else
152-
const std::string debugSparse =
152+
const std::string debugSparse =
153153
"Nonzero entries:\n"
154154
"(1,0) (_,_) (-1.4,2) (_,_) (_,_) (_,_) \n\n"
155155
"Outer pointers:\n"
@@ -173,7 +173,7 @@ TEST(WriteMatrixTest, CanPrintColumnMatrix)
173173
EXPECT_EQ("1\n2\n0", ostr.str());
174174
}
175175

176-
namespace
176+
namespace
177177
{
178178
SparseRowMatrixHandle readSparseMatrixFile(const boost::filesystem::path& filename)
179179
{
@@ -199,12 +199,12 @@ namespace
199199

200200
TEST(WriteMatrixAlgorithmTest, RoundTripRealBinaryFileSparse)
201201
{
202-
auto sparse4 = readSparseMatrixFile(TestResources::rootDir() / "sparse_v4.mat");
202+
auto sparse4 = readSparseMatrixFile(TestResources::rootDir() / "Matrices" / "sparse_v4.mat");
203203
ASSERT_TRUE(sparse4.get() != nullptr);
204204
EXPECT_EQ(5, sparse4->nrows());
205205
EXPECT_EQ(6, sparse4->ncols());
206-
207-
auto v5file = TestResources::rootDir() / "sparse_v5.mat";
206+
207+
auto v5file = TestResources::rootDir() / "Matrices" / "sparse_v5.mat";
208208
writeMatrixToFile(sparse4, v5file);
209209

210210
auto sparse5 = readSparseMatrixFile(v5file);
@@ -215,16 +215,16 @@ TEST(WriteMatrixAlgorithmTest, RoundTripRealBinaryFileSparse)
215215

216216
TEST(WriteMatrixAlgorithmTest, RoundTripRealBinaryFileDense)
217217
{
218-
auto dense4 = readDenseMatrixFile(TestResources::rootDir() / "dense_v4.mat");
218+
auto dense4 = readDenseMatrixFile(TestResources::rootDir() / "Matrices" / "dense_v4.mat");
219219
ASSERT_TRUE(dense4.get() != nullptr);
220220
EXPECT_EQ(5, dense4->nrows());
221221
EXPECT_EQ(6, dense4->ncols());
222-
223-
auto v5file = TestResources::rootDir() / "dense_v5.mat";
222+
223+
auto v5file = TestResources::rootDir() / "Matrices" / "dense_v5.mat";
224224
writeMatrixToFile(dense4, v5file);
225225

226226
auto dense5 = readDenseMatrixFile(v5file);
227227

228228
ASSERT_TRUE(dense5.get() != nullptr);
229229
EXPECT_EQ(*dense4, *dense5);
230-
}
230+
}

0 commit comments

Comments
 (0)