olm/lib/doctest/examples/installed_doctest_cmake/dll/dll.cpp
Hubert Chathi 8475061136 switch to doctest for unit testing
thanks to Nico Werner, who did most of the porting work
2021-12-22 13:45:33 -05:00

22 lines
No EOL
541 B
C++

#define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
#define DOCTEST_CONFIG_IMPLEMENT
#include <doctest/doctest.h>
#include "dll.h"
#include <stdio.h>
extern "C" {
void say_hello_dll() { printf("%s", "Hello, World!\n"); }
}
int factorial(int number) {
return number < 1 ? 1 : number <= 1 ? number : factorial(number - 1) * number;
}
TEST_CASE("testing the factorial function") {
CHECK(factorial(0) == 1);
CHECK(factorial(1) == 1);
CHECK(factorial(2) == 2);
CHECK(factorial(3) == 6);
CHECK(factorial(10) == 3628800);
}