File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ class Status {
112112// / \return State result of calling function.
113113// /
114114template <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)...);
Original file line number Diff line number Diff line change @@ -38,26 +38,34 @@ struct FakeException {
3838
3939TEST (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
4749TEST (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
5557TEST (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
You can’t perform that action at this time.
0 commit comments