fsfw/unittests/testtemplate/TestTemplate.cpp

32 lines
960 B
C++
Raw Permalink Normal View History

#include <catch2/catch_test_macros.hpp>
2020-10-20 17:11:23 +02:00
2022-02-02 10:29:30 +01:00
#include "fsfw_tests/unit/CatchDefinitions.h"
2020-10-20 17:11:23 +02:00
/**
* @brief Template test file
* @details
* In each test case, the code outside the sections is executed
* for EACH section.
* The most common macros to perform tests are:
* - CHECK(...): assert expression and continues even if it fails
* - REQUIRE(...): test case fails if assertion fails
*
* Tests are generally sturctured in test cases and sections, see example
* below.
*
* More Documentation:
* - https://github.com/catchorg/Catch2
* - https://github.com/catchorg/Catch2/blob/master/docs/assertions.md
* - https://github.com/catchorg/Catch2/blob/master/docs/test-cases-and-sections.md
*/
2022-02-02 10:29:30 +01:00
TEST_CASE("Dummy Test", "[DummyTest]") {
uint8_t testVariable = 1;
// perform set-up here
CHECK(testVariable == 1);
SECTION("TestSection") {
// set-up is run for each section
REQUIRE(testVariable == 1);
}
// perform tear-down here
2020-10-20 17:11:23 +02:00
}