@@ -182,10 +182,25 @@ TEST_F(TensorTest, parseTensorFromFileBinary) {
182182
183183TEST_F (TensorTest, parseTensorFromBinaryPython) {
184184 std::string fName = " ../../python/b_d.bt" ;
185- DTensor<double > b = DTensor<double >::parseFromFile (fName );
186- std::vector<double > vb (12 );
187- b.download (vb);
188- for (size_t i = 0 ; i < 12 ; i++) EXPECT_NEAR (i + 1 ., vb[i], PRECISION_HIGH );
185+ DTensor<double > b = DTensor<double >::parseFromFile (fName , rowMajor);
186+ for (size_t i=0 ; i<3 ; i++) {
187+ for (size_t j=0 ; j<3 ; j++) {
188+ EXPECT_NEAR (1 + 2 *j + 6 *i, b (i, j, 0 ), PRECISION_HIGH );
189+ EXPECT_NEAR (2 + 2 *j + 6 *i, b (i, j, 1 ), PRECISION_HIGH );
190+ }
191+ }
192+ }
193+
194+
195+ /* ---------------------------------------
196+ * Parse not existing file
197+ * --------------------------------------- */
198+
199+ TEST_F (TensorTest, parseTensorFromNonexistentFile) {
200+ std::string fName = " ../../python/whatever.bt" ;
201+ EXPECT_THROW (DTensor<double > b = DTensor<double >::parseFromFile (fName , rowMajor), std::invalid_argument);
202+ std::string fName2 = " ../../python/whatever.txt" ;
203+ EXPECT_THROW (DTensor<double > b = DTensor<double >::parseFromFile (fName2 , rowMajor), std::invalid_argument);
189204}
190205
191206
0 commit comments