Skip to content

Commit da8d3d0

Browse files
committed
rename funcs, test=develop
1 parent e69ef96 commit da8d3d0

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

paddle/fluid/inference/api/paddle_infer_contrib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class Status {
112112
/// \return State result of calling function.
113113
///
114114
template <typename Func, typename... Args>
115-
Status status_wrapper(Func func, Args&&... args) noexcept(
115+
Status get_status(Func func, Args&&... args) noexcept(
116116
noexcept(Status(std::declval<Status>()))) {
117117
try {
118118
func(std::forward<Args>(args)...);

paddle/fluid/inference/tests/api/paddle_infer_api_errors_tester.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,34 @@ struct FakeException {
3838

3939
TEST(Status, pd_exception) {
4040
FakeException e;
41-
Status status = status_wrapper([&]() { e.pd_exception(1); });
41+
Status status = get_status([&]() { e.pd_exception(1); });
4242
CHECK(!status.ok());
43+
CHECK(status == status);
44+
CHECK(!(status != status));
4345
CHECK_EQ(status.code(), paddle::platform::error::INVALID_ARGUMENT + 1);
4446
LOG(INFO) << status.error_message();
4547
}
4648

4749
TEST(Status, basic_exception) {
4850
FakeException e;
4951
Status status;
50-
status = status_wrapper([&]() { e.base_exception(); });
52+
status = get_status([&]() { e.base_exception(); });
5153
CHECK(!status.ok());
5254
LOG(INFO) << status.error_message();
5355
}
5456

5557
TEST(Status, no_exception) {
5658
FakeException e;
5759
Status status;
58-
status = status_wrapper([&]() { e.no_exception(); });
60+
status = get_status([&]() { e.no_exception(); });
5961
CHECK(status.ok());
6062
}
6163

64+
TEST(Status, copy) {
65+
Status status;
66+
Status status_1(status);
67+
status_1 = status;
68+
}
69+
6270
} // namespace contrib
6371
} // namespace paddle_infer

0 commit comments

Comments
 (0)