Loading...
Searching...
No Matches
C++ Unittests

RIOT unit tests for C++. More...

Detailed Description

RIOT unit tests for C++.

The C++ unit test framework syntax is loosely based on GoogleTest, but offers far less functionality. For mocking the package Fake Functions Framework can be used.

Files

file  cppunit.hpp
 RIOT unit tests for C++.
 
file  cppunit_base.hpp
 RIOT unit tests for C++ base classes and macros.
 
file  cppunit_expect.hpp
 RIOT unit tests for C++ assertion macros.
 
file  cppunit_fff.hpp
 RIOT unit tests for C++ assertion macros for Fake Functions Framework.
 

Namespaces

namespace  riot
 RIOT C++ namespace.
 

Macros

#define CPPUNIT_SUITE_CNT   (10)
 Maximum amount of tests in one test suite.
 
#define RUN_SUITE(name)
 Run the test suite name.
 
#define TEST_SUITE_F(suite, name)
 Instantiate a test suite with custom test fixture.
 
#define TEST_SUITE(name)
 Instantiate a test suite.
 
#define TEST(suite, name)
 Begin the definition of a test.
 
#define EXPECT_EQ(expected, actual, msg)
 Expect equality of the actual and expected value.
 
#define EXPECT_STREQ(expected, actual, msg)
 Expect string equality of the actual and expected value.
 
#define EXPECT_FFF_CALL_COUNT(name, count)
 Expect count calls to name mock.
 
#define EXPECT_FFF_CALL_PARAMS(mock, ...)
 Expect that the last call to mock was made with the given parameters.
 

Macro Definition Documentation

◆ CPPUNIT_SUITE_CNT

#define CPPUNIT_SUITE_CNT   (10)

Maximum amount of tests in one test suite.

Definition at line 27 of file cppunit_base.hpp.

◆ EXPECT_EQ

#define EXPECT_EQ (   expected,
  actual,
  msg 
)

Expect equality of the actual and expected value.

Parameters
[in]expectedExpected value
[in]actualActual value
[in]msgMessage to print in case of failure

Definition at line 26 of file cppunit_expect.hpp.

◆ EXPECT_FFF_CALL_COUNT

#define EXPECT_FFF_CALL_COUNT (   name,
  count 
)

Expect count calls to name mock.

Needs the Fake Functions Framework for mocks

Parameters
[in]nameName of the mock
[in]countExpected calls

Definition at line 26 of file cppunit_fff.hpp.

◆ EXPECT_FFF_CALL_PARAMS

#define EXPECT_FFF_CALL_PARAMS (   mock,
  ... 
)

Expect that the last call to mock was made with the given parameters.

Needs the Fake Functions Framework for mocks

Parameters
[in]mockName of the mock
[in]...params

Definition at line 128 of file cppunit_fff.hpp.

◆ EXPECT_STREQ

#define EXPECT_STREQ (   expected,
  actual,
  msg 
)

Expect string equality of the actual and expected value.

Interprets both values as const char* string

Parameters
[in]expectedExpected value
[in]actualActual value
[in]msgMessage to print in case of failure

Definition at line 52 of file cppunit_expect.hpp.

◆ RUN_SUITE

#define RUN_SUITE (   name)

Run the test suite name.

Parameters
[in]nameName of the suite

Definition at line 136 of file cppunit_base.hpp.

◆ TEST

#define TEST (   suite,
  name 
)

Begin the definition of a test.

Insert the test body after the macro

Parameters
[in]suiteName of the suite to add the test to
[in]nameInstantiation name of the test

Definition at line 168 of file cppunit_base.hpp.

◆ TEST_SUITE

#define TEST_SUITE (   name)

Instantiate a test suite.

Parameters
[in]nameInstantiation name of the suite

Definition at line 159 of file cppunit_base.hpp.

◆ TEST_SUITE_F

#define TEST_SUITE_F (   suite,
  name 
)

Instantiate a test suite with custom test fixture.

Parameters
[in]suiteName of the custom test fixture class
[in]nameInstantiation name of the suite

Definition at line 144 of file cppunit_base.hpp.