c++ - "Assert and return" macro in Google Test? -


is there assert_and_return macro in google test test something, , if it's false, raises assertion , returns value?

actually every assert_xxx returns function - not return value - assumed function (in cases functions created testxx macros) void function.

this issue when use assert_xxx within function called function. check if function failed on assert - need use assert_no_fatal_failure

see example

void assertnotnull(int *p) {     assert_that(p, notnull(p)); } void assertsizeis(int actual, int expected) {     assert_eq(actual, expected); } test(a, b) {    std::pair<int*,int> p = createarray(7);     assert_no_fatal_failure(assertnotnull(p.first));    assert_no_fatal_failure(assertsizeis(p.second, 7));     for( int = 0; < 7; ++i)        assert_eq(0, p.first[i]); } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -