Skip to main content

C++

Tests

Tests are to be written with the googletest framework. First, the framework must be included in the test file:

my_test.cc
#include <gtest/gtest.h>

Then, assertions can be made within test functions as follows:

my_test.cc
#include <gtest/gtest.h>
#include "fac.h"

// Demonstrate some basic assertions.
TEST(fac, t1) {
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");
// Expect equality.
EXPECT_EQ(7 * 6, 42);
}
TEST(fac, t2) {
EXPECT_EQ(fac(5), 120) << "falsch";
}

TEST(fac, t3) {
EXPECT_EQ(fac(0), 1);
}

Environments

Currently, the only available environment is cpp13, which includes GCC 12.