How to send custom message in Google C++ Testing Framework?

后端 未结 6 1764
闹比i
闹比i 2020-12-22 20:59

I use Google C++ Testing Framework for unit testing of my code. I use Eclipse CDT with C++ Unit testing module for output analysis.

Previously I used CppUnit it ha

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 21:23

    From the Advanced googletest Topics you can use a few macros for that purpose.

    • SUCCEED() SUCCEED() << "success/info message"; SUCCEED() only outputs your message and proceeds. It does not mark test as passed. Its result will be determined by the following asserts.
    • FAIL() FAIL() << "test failure message"; FAIL() marks your test as failed, outputs your message and then returns from the function. Therefore can only be used in functions returning void.
    • ADD_FAILURE() ADD_FAILURE() << "test failure message"; ADD_FAILURE() marks your test as failed and outputs your message. It does not return from the calling function and execution flow continues like with EXPECT_ series of macros.

提交回复
热议问题