I am testing C code using googleTest. My test.cpp file look like that
#include <gtest/gtest.h>
extern "C" {
#include "list.h"
#include "list.c"
}
TEST(ListTest, singleInsertion) {
// some tests
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
However trying to run the test from the terminal using g++ test.cpp -lgtest
gives Errors and warning as if the code being tested is C++ not C.
Error and warning Examples : error: invalid conversion for mallocs
and warning: ISO C++ forbids converting a string constant to ‘char*'
how can I declare that my tested files are C not C++ ?
Aucun commentaire:
Enregistrer un commentaire