unittest++

Linker errors with codelite, unittest++ and g++ on linux

北城余情 提交于 2020-02-04 05:20:29
问题 I'm new to unit testing in c++, and writing c++ on Linux (Mint). I'm using CodeLite as my IDE. I have found several answers on stackoverflow about linker errors, but after hours of trying various solutions I have not succeeded in implementing a solution correctly. I installed unittest++ through apt-get. The unittest++ header files were installed in /usr/include, so I added this to the Compiler linker options in Codelite (Right click project name->Settings, Compiler): Codelite screenshot I

Unit testing methods created by a macro

岁酱吖の 提交于 2019-12-13 06:30:52
问题 I have a program written in C++ and to make sure we don't break anything when making a change I would like to add unit tests. In the program we used macros to create certain objects that are frequently used. This would look like: #define PROPERTY_SWITCHPOINT(var) \ private: \ comp::SwitchPoint* m##var; \ public: \ void set##var(bool val, unsigned short switchIdx = 0) \ {\ if(m##var) m##var->setValue(val,switchIdx); \ }\ bool get##var() \ {\ return (NULL == m##var ? false : m##var->getValue())

Linker errors when trying to link code in tests using UnitTest++

蹲街弑〆低调 提交于 2019-12-11 04:48:29
问题 So I'm using Unittest++ (version 1.4) I've tried making a couple of dummy tests (CHECK(true) and CHECK(false), and those work fine. However, as soon as I try to include some production code, the linker goes nuts over using any class or function from the headers that I've included for testing. My questions are: Can this be caused by anything in UnitTest++? How do I set up my code or the project in Code::Blocks to make this error go away? Details: I have used unit testing before with java and C