problem about cppunit-Collection of common programming errors


  • emmerich
    c++ gcc macros cppunit
    I have a project which has two base exception classes; both have the same name, only the methods/members differ (one has a method which returns the message, the other has only a string member which can be accessed for info regarding the exception).I’m using CPPUNIT for testing and in the framework there’s the TestAssert.hpp file which contains macros for every assertion (CPPUNIT_ASSERT_NO_THROW, etc.). I’ve modified adding in it another macros which test what exception headers are included in th

  • timday
    c++ unit-testing boost cppunit boost-test
    I’ve used both CppUnit and boost::test for C++ unittesting. Generally I prefer boost::test, mainly because the auto-test macros minimise the effort to setup tests. But there’s one thing I really miss from CppUnit: the ability to register your own “protectors”, instances of which automatically wrap all the run tests. (Technically, you install a test “listener”, and that can wrap each test in a protector scope).I’ve found these invaluable in the past for monitoring unittests for unexpected side

  • Mat
    compilation qt4 qmake cppunit test-runner
    I am trying to compile a .pro file using qmake and Qt4 to get a library from qttestrunnerlib.pro but I get this error:~/docs/UT_Cpp_Test/main/cppDir/src/qttestrunner$ qmake qttestrunnerlib.pro uic: Error in line 6, column 14 : Unexpected element name uic: Error in line 6, column 14 : Unexpected element nameWhen I use Qt3 it works, and I get my lib successfully. But I want to upgrade it to Qt4. Is it possible? and what should I do?

  • prosseek
    visual-studio visual-studio-2010 cppunit
    I downloaded and compiled CppUnit to compile with Visual Studio 2010.After the conversion, I could load the CppUnitLibraries, and it gives me cppunit.lib and cppunit_dll.lib/dll. After copying the headers and libs to a directory, I run this command to get a lot of errors. I found the conflict of libraries as followsLINK : warning LNK4098: defaultlib ‘MSVCRTD’ conflicts with use of other libs; use /NODEFAULTLIB:libraryHowever, the following command doesn’t seem to work.cl main.cpp complex.cpp tes

  • ratkok
    cppunit
    I am using CppUnit as a unit test framework. Is it possible to select a subset of testcases to execute at runtime? Is there a filtering option provided within CppUnit to accomodate this?

  • skaffman
    visual-c++ cppunit
    error is Application has failed to start because MSVCP90D.dll was not found.

  • user869525
    c++ qt cppunit
    So, I’m trying to learn CppUnit testing. Since CppUnit needs it’s own main function to run tests, I figured I would move my test suite into it’s own sub-project. If that whole philosophy is wrong, please correct me. Then I will push this to my Git server and try to get the tests running in Jenkins on a Gerrit trigger. Ultimately, I’m trying to learn Jenkins and I’m creating a simple project to help me in that end. However, when I compile I get a lot of issues related to the files in Jenkins

  • shearn89
    linker cmake cppunit ctest
    This may already be answered somewhere, so please point me in the right direction if so – I couldn’t find anything that matched my specific problem when googling!I’ve got some CppUnit tests that I’m trying to run.My top-level CMakeLists.txt contains:include_directories(${CPPUNIT_INC} ) link_directories(${CPPUNIT_LIB} )Both of which are set correctly: I print the paths earlier in the CMakeLists.txt file, and they’re correct.In the subfolder, I have;add_executable(test-lumberjack TestLumberjack.cp

  • paxdiablo
    c++ unit-testing cppunit
    I am learning CppUnit, and my code coredumped when calling TestRunner::run(). That’s line 34 in the below code. I can not see anything wrong. It is almost identical to the sample code in the CppUnit cookbook.#include <iostream> #include <cppunit/TestCaller.h> #include <cppunit/TestSuite.h> #include <cppunit/ui/text/TestRunner.h> using namespace std; //class MyFixture: public CppUnit::TestFixture { class MyFixture{ public: MyFixture() {cout<<“MyFixture:

  • dda
    c++ visual-studio-2012 const stackoverflow cppunit
    In my VC++ CPPUNIT project the following code in a unit test causes a stack overflow exception:const int n = 1000000; const char *test[n];First-chance exception at 0x00AD89E7 in Utilities_Tests.exe:0xC00000FD: Stack overflow (parameters: 0x00000000, 0x00132000).Unhandled exception at 0x00AD89E7 in Utilities_Tests.exe: 0xC00000FD:Stack overflow (parameters: 0x00000000, 0x00132000).But this does not:const int n = 1000000; char test[n];The stack overflow happens before the code is executed, thus a

  • wyatt lindsey
    access-violation unhandled-exception cppunit
    I have a set of classes to which I am trying to apply unit tests, to maintain their current utility through future revisions.My problem is that within CPPUNIT, to which I am new, where-ever I call CPPUNIT_ASSERT ( [condition] ), I am met with Error Unhandled Exception…: Access Violation at 0xffffffffffffffff.This happens even I write the simplest test caseint main(){CPPUNIT_ASSERT ( true ); }I have tried calling my testing functions with manual calls, as well as adding them to a registry, as i

  • DanB91
    c++ osx linker clang cppunit
    I am trying to compile a test program using CppUnit. The problem is, with this sample code: //[…]class EntityComponentTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( EntityComponentTest ); CPPUNIT_TEST( testGetComponents ); CPPUNIT_TEST_SUITE_END(); Entity e;public: void setUp(){e.addComponent(“1”, new TestComponent(“Hello 1”));e.addComponent(“2”, new TestComponent(“Hello 2”)); }void tearDown(){}void testGetComponents() {TestComponent &first = static_cast<TestComponent&>

  • giovedy
    c++ makefile cppunit
    I’ve got two classes : EtatTrafic and EtatTraficTest.This is my makefile :#Makefile CXX = g++ LDLIBS = -lcppunit# a modifier en fonction des cas OBJS = EtatTrafic.o EtatTraficTest.o all : TestUnitaireTestUnitaire: $(OBJS)$(CXX) $^ -o $@ $(LDFLAGS) $(LDLIBS)#création des objets %.o : %.cpp$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<# a modifier en fonction des cas EtatTrafic.o: EtatTrafic.hpp EtatTraficTest.o: EtatTrafic.hpp EtatTraficTest.hpp clean:rm *.o $(EXEC)When i try to compile I get som

  • therefromhere
    netbeans cppunit build-error
    I am trying to run some tests with cppUnit tests on NETBEANS on Mac – Lion OS10x but I get this error after i try to compile it: /usr/bin/make” -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf “/usr/bin/make” -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/xxx make[2]: `dist/Debug/GNU-MacOSX/xxx’ is up to date. “/usr/bin/make” -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-tests-conf “/usr/bin/make” -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/xxx make[2]: `dist

  • jalf
    c++ unit-testing cppunit
    I’ve come across cppunit but it didn’t look super-easy to use (maybe I didn’t look hard, maybe because C++ doesn’t work like Java/C#). Are there widely used, simple alternatives?In fact, is cppunit the standard unit testing framework for C++?

  • Jiew Meng
    c++ visual-c++ cppunit
    I have a Parser.h, that defines a struct StmtParent: … struct StmtParent;class Parser { …Then in Parser.cpp: struct StmtParent {int stmtNo;int parent; }; … Seems all right? Then I have a unit test (cppunit): # in ParserUnitTests.h #include “header\Parser.h”# in ParserUnitTests.cpp void ParserUnitTests::testParseProcSideEffects() { … stack<StmtParent> follows;…Then I get errors like: error C2027: use of undefined type ‘StmtParent’Why, I can use functions like Parser::parseLine().

  • dagorym
    c++ linux unit-testing cppunit
    I’m setting up a bunch of unit tests using CppUnit but am having the problem that none of the tests are being run. The project is divided up into several small libraries and I planned on dividing the unit test classes up the same way and then linking them all into a single test program. The problem is, then the test classes are in their own libraries, they don’t get linked into the main test program unless I explicitly call them, i.e. I have to put in runner.addTest( TestClass::suite() );indiv

  • LizyCV
    c++ include cppunit
    I have a project that have a Container class and an iterator class. In the code, the container looks like:#pragma once #ifndef size_type #define size_type unsigned int #endif #include “Iterator.h” #include “SimpleContainerReverseIterator.h” #include “SimpleContainerIterator.h” // Interface /// class Container -template <typename T>class Container {// Operationspublic:virtual ~Container ();virtual Iterator<T>* createIterator () = 0;virtual Iterator<T>* createReverseIterator ()

  • G-71
    c++ unit-testing ubuntu cppunit
    I’va installed cppunit library on my kubuntu 11.10, using this command:sudo apt-get install libcppunit-1.12-1 libcppunit-dev libcppunit-doc sudo apt-get install libcppunit-subunit-dev libcppunit-subunit0before this i run the: apt-cache search cppunit command, as a result:libcppunit-1.12-1 – Unit Testing Library for C++ libcppunit-dev – Unit Testing Library for C++ libcppunit-doc – Unit Testing Library for C++ libcppunit-subunit-dev – SubunitTestProgressListener for CPPUnit – Development headers

  • ouou
    c++ qt linker cppunit
    I am working in a project based on the lib cppunit, I need to run my tests with qttestrunner I make the libqttestrunnerd.a (qmake qttestrunnerlib.pro and make ), obviously there is a problem of linking, here is a sample of output:/home/oumaya/docs/UT_Cpp_Test/main/cppDir/lib/lib/libqttestrunnerd.a(moc_testbrowserdlg.o):(.rodata._ZTV15TestBrowserBase[vtable for TestBrowserBase]+0x30): undefined reference to ‘QWidget::setName(char const*)’ /home/oumaya/docs/UT_Cpp_Test/main/cppDir/lib/lib/libqtte

  • Naddiseo
    ubuntu dynamic-linking cppunit
    I think I’m missing something really stupid here. I have libcppunit installed: (I’m using Ubuntu 12.04)$ apt-cache policy libcppunit-dev libcppunit-dev:Installed: 1.12.1-4Candidate: 1.12.1-4Version table:*** 1.12.1-4 0500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages100 /var/lib/dpkg/status$ apt-cache policy libcppunit-1.12-1 libcppunit-1.12-1:Installed: 1.12.1-4Candidate: 1.12.1-4Version table:*** 1.12.1-4 0500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages100 /

  • Mat
    c++ qt compiler cppunit
    I have a project use cppunit for unit test, I used QTtestrunner to show the result here is the codeCPPUNIT_NS::QtUi::TestRunner testrunner; testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest()); testrunner.run (true);but I have this message in compiling:src/main.cpp:78: undefined reference to ‘CppUnit::QtTestRunner::QtTestRunner()’ src/main.cpp:79: undefined reference to CppUnit::QtTestRunner::addTest(CppUnit::Test*)’ src/main.cpp:80: undefined referen

  • giovedy
    makefile cppunit
    this is my makefile :#Makefile CC=g++ CFLAGS=-lcppunit OBJS=Money.o MoneyTest.oall : $(OBJS)$(CC) $(OBJS) -o TestUnitaire#création des objets Money.o: Money.cpp Money.hpp$(CC) -c Money.cpp $(CFLAGS)MoneyTest.o: MoneyTest.cpp Money.hpp MoneyTest.hpp$(CC) -c MoneyTest.cpp $(CFLAGS)clean:rm *.o $(EXEC)when i run this makefile, i get errors like those :g++ Money.o MoneyTest.o -o TestUnitaireMoney.o: In function main’:Money.cpp:(.text+0x3c): undefined reference toCppUnit::TestFactoryRegistry::getReg

  • Sean
    c++ linux reference undefined cppunit
    I’m trying to use CppUnit but have noticed that anytime I get to the linking phase of my code I’m being told I have a bunch of undefined references from things like CppUnit::TextTestRunner etc. I confirmed these were undefined by looking at libcppunit.a and sure enough most of the .o files are nothing but undefined references. I tried rebuilding and making the installation but noticed that if finishes during make with /link being unable to find references to said interfaces. Has anyone else expe

Web site is in building