MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / foo

Function foo

common/test/test.cpp:954–968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

952}
953
954photon::retval<int> foo(int i) {
955 switch (i) {
956 default:
957 return 32;
958 case 1:
959 return reterr{EINVAL};
960 case 2:
961 LOG_ERROR_RETVAL(EADDRINUSE, "trying to use LOG_ERROR_RETVAL() with an error number constant");
962 case 3:
963 retval<double> ret = bar();
964 EXPECT_TRUE(ret.failed());
965 // pass on ONLY the error number
966 LOG_ERROR_RETVAL(ret, "trying to pass on an existing (failed) retval<double> to retval<int>");
967 }
968}
969
970retval<void> ret_failed() {
971 return {EBADF};

Callers 1

TESTFunction · 0.85

Calls 2

barFunction · 0.85
failedMethod · 0.45

Tested by

no test coverage detected