C/C++ API Reference
Loading...
Searching...
No Matches
Test control

Oveview

Macros

#define ADD_FAILURE()
 
#define GTEST_FAIL()   return ADD_FAILURE()
 
#define GTEST_SKIP()
 
#define FAIL()   GTEST_FAIL()
 
#define GTEST_SUCCEED()
 
#define SUCCEED()   GTEST_SUCCEED()
 
#define SCOPED_TRACE(message)
 
#define GTEST_HAS_DEATH_TEST   0
 
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
 
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex)    EXPECT_DEATH_IF_SUPPORTED(statement, regex)
 

Functions

int RUN_ALL_TESTS ()
 

Macro Definition Documentation

◆ ADD_FAILURE

#define ADD_FAILURE ( )
Value:
::pw::unit_test::internal::Framework::Get().CurrentTestExpectSimple( \
"(line is not executed)", "(line was executed)", __LINE__, false)
Definition: framework_backend.h:453

Generates a non-fatal failure with a generic message.

◆ ASSERT_DEATH_IF_SUPPORTED

#define ASSERT_DEATH_IF_SUPPORTED (   statement,
  regex 
)     EXPECT_DEATH_IF_SUPPORTED(statement, regex)

See GTEST_HAS_DEATH_TEST.

◆ EXPECT_DEATH_IF_SUPPORTED

#define EXPECT_DEATH_IF_SUPPORTED (   statement,
  regex 
)
Value:
if (0) { \
static_cast<void>(statement); \
static_cast<void>(regex); \
} \
static_assert(true, "Macros must be terminated with a semicolon")

See GTEST_HAS_DEATH_TEST.

◆ FAIL

#define FAIL ( )    GTEST_FAIL()

Generates a fatal failure with a generic message.

If this generic name is clashing with other code, set GTEST_DONT_DEFINE_FAIL to 1 and use GTEST_FAIL instead.

◆ GTEST_FAIL

#define GTEST_FAIL ( )    return ADD_FAILURE()

Alias of FAIL.

◆ GTEST_HAS_DEATH_TEST

#define GTEST_HAS_DEATH_TEST   0

Death tests are not supported. The *_DEATH_IF_SUPPORTED macros do nothing.

◆ GTEST_SKIP

#define GTEST_SKIP ( )
Value:
return ::pw::unit_test::internal::ReturnHelper() = \
::pw::unit_test::internal::Framework::Get().CurrentTestSkip( \
__LINE__)

Skips test at runtime. Skips are neither successful nor failed. They abort the current function.

◆ GTEST_SUCCEED

#define GTEST_SUCCEED ( )
Value:
::pw::unit_test::internal::Framework::Get().CurrentTestExpectSimple( \
"(success)", "(success)", __LINE__, true)

Alias of SUCCEED.

◆ SCOPED_TRACE

#define SCOPED_TRACE (   message)

SCOPED_TRACE is not supported. This macro does nothing.

◆ SUCCEED

#define SUCCEED ( )    GTEST_SUCCEED()

Generates success with a generic message.

If this generic name is conflicting with other code, set GTEST_DONT_DEFINE_SUCCEED to 1 and use GTEST_SUCCEED instead.

Function Documentation

◆ RUN_ALL_TESTS()

int RUN_ALL_TESTS ( )
inline

The pw_unit_test framework entrypoint. Runs every registered test case and dispatches the results through the event handler.

Precondition
An event handler has been registered before calling RUN_ALL_TESTS.
Returns
A status of 0 if all tests passed, or non-zero if there were any failures. This is compatible with GoogleTest.