|
34 | 34 | #include "litert/c/litert_common.h" |
35 | 35 | #include "litert/c/litert_model_types.h" |
36 | 36 | #include "litert/cc/internal/litert_c_types_printing.h" // IWYU pragma: keep |
| 37 | +#include "litert/cc/litert_common.h" |
37 | 38 | #include "litert/cc/litert_element_type.h" |
38 | 39 | #include "litert/cc/litert_expected.h" |
39 | | -#include "litert/cc/litert_macros.h" |
40 | | -#include "litert/cc/litert_model.h" |
| 40 | +#include "litert/cc/litert_ranked_tensor_type.h" |
41 | 41 |
|
42 | 42 | // Is equivalent to `ASSERT_THAT(expr, testing::litert::IsOk())` |
43 | 43 | #define LITERT_ASSERT_OK(EXPR) ASSERT_THAT((EXPR), ::testing::litert::IsOk()) |
@@ -348,32 +348,42 @@ inline IsErrorMatcher IsError() { |
348 | 348 | } |
349 | 349 |
|
350 | 350 | // Matches `litert::Expected`, `litert::Unexpected`, `litert::Error` and |
351 | | -// `LiteRtStatus` values that hold a specific error status. |
| 351 | +// `litert::Status` values that hold a specific error status. |
352 | 352 | // |
353 | 353 | // ```cpp |
354 | 354 | // Expected<Something> BuildSomething(); |
355 | 355 | // |
356 | 356 | // // Will fail the test if BuildSomething()'s returned object holds a value or |
357 | | -// // if the error status is not `kLiteRtStatusErrorSystemError`. |
358 | | -// EXPECT_THAT(BuildSomething(), IsError(kLiteRtStatusErrorSystemError)); |
| 357 | +// // if the error status is not `kErrorSystemError`. |
| 358 | +// EXPECT_THAT(BuildSomething(), IsError(::litert::Status::kErrorSystemError)); |
359 | 359 | // ``` |
| 360 | +inline IsErrorMatcher IsError(::litert::Status status) { |
| 361 | + return IsErrorMatcher(static_cast<LiteRtStatus>(status), |
| 362 | + /*msg=*/std::nullopt); |
| 363 | +} |
| 364 | + |
360 | 365 | inline IsErrorMatcher IsError(LiteRtStatus status) { |
361 | 366 | return IsErrorMatcher(status, /*msg=*/std::nullopt); |
362 | 367 | } |
363 | 368 |
|
364 | | -// Matches `litert::Expected` and `LiteRtStatus` values that have a specific |
| 369 | +// Matches `litert::Expected` and `litert::Status` values that have a specific |
365 | 370 | // error status and error message. |
366 | 371 | // |
367 | | -// Warning: This will always return `false` for `LiteRtStatus` objects as those |
368 | | -// do not convey a message. |
| 372 | +// Warning: This will always return `false` for `litert::Status` objects as |
| 373 | +// those do not convey a message. |
369 | 374 | // |
370 | 375 | // ```cpp |
371 | 376 | // Expected<Something> BuildSomething(); |
372 | 377 | // |
373 | 378 | // // Will fail the test if BuildSomething()'s returned object holds a value. |
374 | | -// EXPECT_THAT(BuildSomething(), IsError(kLiteRtStatusErrorSystemError, |
| 379 | +// EXPECT_THAT(BuildSomething(), IsError(::litert::Status::kErrorSystemError, |
375 | 380 | // "System is not initialised")); |
376 | 381 | // ``` |
| 382 | +inline IsErrorMatcher IsError(::litert::Status status, std::string msg) { |
| 383 | + return IsErrorMatcher(static_cast<LiteRtStatus>(status), std::move(msg)); |
| 384 | +} |
| 385 | + |
| 386 | +[[deprecated("Use the litert::Status version instead.")]] |
377 | 387 | inline IsErrorMatcher IsError(LiteRtStatus status, std::string msg) { |
378 | 388 | return IsErrorMatcher(status, std::move(msg)); |
379 | 389 | } |
|
0 commit comments