Make an interpreter that has no tensors and no nodes
| 62 | |
| 63 | // Make an interpreter that has no tensors and no nodes |
| 64 | TEST(BasicInterpreter, ZeroInterpreter) { |
| 65 | testing::internal::CaptureStderr(); |
| 66 | |
| 67 | Interpreter interpreter; |
| 68 | |
| 69 | #ifndef NDEBUG |
| 70 | const char* kExpectedLog = "INFO: Initialized TensorFlow Lite runtime"; |
| 71 | #else |
| 72 | const char* kExpectedLog = ""; |
| 73 | #endif |
| 74 | EXPECT_THAT(testing::internal::GetCapturedStderr(), |
| 75 | testing::HasSubstr(kExpectedLog)); |
| 76 | |
| 77 | interpreter.SetInputs({}); |
| 78 | interpreter.SetOutputs({}); |
| 79 | ASSERT_EQ(interpreter.AllocateTensors(), kTfLiteOk); |
| 80 | ASSERT_EQ(interpreter.Invoke(), kTfLiteOk); |
| 81 | |
| 82 | // Creating a new interpreter should not redundantly log runtime init. |
| 83 | testing::internal::CaptureStderr(); |
| 84 | Interpreter interpreter2; |
| 85 | EXPECT_THAT(testing::internal::GetCapturedStderr(), IsEmpty()); |
| 86 | } |
| 87 | |
| 88 | // Test various error conditions. |
| 89 | TEST(BasicInterpreter, InvokeInvalidModel) { |
nothing calls this directly
no test coverage detected