unittest-cpp | A lightweight unit testing framework for C | Reflection library
kandi X-RAY | unittest-cpp Summary
Support
Quality
Security
License
Reuse
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
unittest-cpp Key Features
unittest-cpp Examples and Code Snippets
Trending Discussions on unittest-cpp
Trending Discussions on unittest-cpp
QUESTION
$ sudo apt install libunittest++-dev
After that
$ sudo find / -iname "*UnitTest++.*" 2> /dev/null
/usr/include/UnitTest++/UnitTest++.h
/usr/lib/x86_64-linux-gnu/pkgconfig/UnitTest++.pc
/usr/lib/x86_64-linux-gnu/libUnitTest++.so
/usr/lib/x86_64-linux-gnu/libUnitTest++.so.2
/usr/lib/x86_64-linux-gnu/libUnitTest++.so.2.0.0
But there's no libUnitTest++.a
as I have in Windows where I compiled UnitTest++ myself according the instructions here. Also I don't see the source code files.
Can I use this installation for my testing or need to download the sources and compile them myself? Or how can I use libUnitTest++.so
instead of libUnitTest++.a
?
Here is one of my tests:
#include "UnitTest++/UnitTest++.h"
#include "skip_list.cpp"
#include
using namespace std;
TEST(NodeTest)
{
SkipListNode node(15, 2);
CHECK_EQUAL(15, node.key);
CHECK_EQUAL(2, node.height);
CHECK(!node.next[0]);
CHECK(!node.next[1]);
CHECK(!node.next[2]);
}
int main(int, const char *[])
{
return UnitTest::RunAllTests();
}
Now it says:
g++ -std=c++11 -Wall -g skip_list_test.cpp
/tmp/cc2zCui4.o: In function `TestNodeTest::RunImpl() const':
/home/greg/study/data_structures/02_03_01_skip_list/skip_list_test.cpp:16: undefined reference to `UnitTest::CurrentTest::Details()'
ANSWER
Answered 2020-Apr-10 at 19:26As there's no answer, removed the UnitTest++ deb-packages:
$ sudo apt remove libunittest++2 libunittest++-dev
Cloned the Git project and compiled it according the instructions above. Now it works:
g++ -std=c++11 -Wall -g -c -I/usr/local/include/ skip_list_test.cpp
g++ -std=c++11 -Wall -g skip_list_test.o /usr/local/lib/libUnitTest++.a -o skip_list_test.out
./skip_list_test.out
Success: 2 tests passed.
Test time: 0.00 seconds.
And as for the installed artifacts:
$ sudo find / -iname "*UnitTest++.*" 2> /dev/null
/usr/local/include/UnitTest++/UnitTest++.h
/usr/local/lib/pkgconfig/UnitTest++.pc
/usr/local/lib/libUnitTest++.a
Anyway any other answers are welcome :)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install unittest-cpp
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page