но я не вижу регистрации тестовых случаев. Вот что я делаю.
plugin.cpp
Код: Выделить всё
#define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN
#include
DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END
// most of these are used here just to test that they compile successfully from within a plugin
TEST_SUITE("some test suite") {
TEST_CASE("test case in a plugin") {
SUBCASE("some subcase") {
INFO("some info");
MESSAGE("triggering the INFO above to be printed");
CHECK(1 == 2);
FAIL("certain death!");
}
}
}
// set an exception translator for char
REGISTER_EXCEPTION_TRANSLATOR(char& e) {
return doctest::String("char: ") + doctest::toString(e);
}
Код: Выделить всё
g++ -fPIC -c plugin.cpp -o plugin.o
g++ -shared -o libplugin.so plugin.o
Код: Выделить всё
#define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"
#include
REGISTER_EXCEPTION_TRANSLATOR(double& e) {
return doctest::String("double: ") + doctest::toString(e);
}
int main(int argc, char** argv) {
void *handle = dlopen("libplugin.so", RTLD_NOW);
if(handle == nullptr) {
fprintf(stderr, "Error loading plugin: %s\n", dlerror());
return 1;
}
fprintf(stderr, "Plugin loaded successfully\n");
doctest::Context context(argc, argv);
int res = context.run();
return res;
}
Код: Выделить всё
g++ main.cpp -ldl -o a.out
, я не вижу ни одного запуска тестовых случаев
Код: Выделить всё
Plugin loaded successfully
[doctest] doctest version is "2.4.12"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 0 | 0 passed | 0 failed | 0 skipped
[doctest] assertions: 0 | 0 passed | 0 failed |
[doctest] Status: SUCCESS!
Подробнее здесь: https://stackoverflow.com/questions/797 ... -doctest-c
Мобильная версия