| 19 | namespace dali { |
| 20 | |
| 21 | TEST(Error, EnforceFailed) { |
| 22 | std::string file_and_line; |
| 23 | std::string message = "Test message"; |
| 24 | try { |
| 25 | // the two statements below must be in one line! |
| 26 | file_and_line = FILE_AND_LINE; DALI_ENFORCE(!"Always fail", message); |
| 27 | FAIL() << "Exception was expeceted"; |
| 28 | } catch (DALIException &e) { |
| 29 | std::string msg = e.what(); |
| 30 | EXPECT_NE(e.GetFileAndLine().find(file_and_line), std::string::npos) |
| 31 | << "File/line spec not found in error `what()`, which is:\n" << msg; |
| 32 | EXPECT_NE(msg.find(message), std::string::npos) |
| 33 | << "Original message not found in error `what()`, which is:\n" << msg; |
| 34 | } catch (...) { |
| 35 | FAIL() << "Expected DALIException, got other exception"; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | TEST(Error, CudaError) { |
| 40 | try { |
nothing calls this directly
no test coverage detected