Menu

Problem with ASSERT macros

Help
2003-11-01
2003-11-26
  • Joachim Käßer

    Joachim Käßer - 2003-11-01

    After bringing the qttestrunner to work, i ran into a new problem, wich has to do with the ASSERT macros.

    Every failed condition, wich i test with one of the macros CPPUNIT_ASSERT(), CPPUNIT_ASSERT_EQUAL() and CPPUNIT_ASSERT_DOUBLES_EQUAL() crashes the program with an seqmentation fault if and only if the condition evaluates to "false".

    The same applies to devision by zero faults. In both cases the exception, thrown by the cppunit-framework, immediately halts the tested application.

    I suppose, the same problem on a different platform is discussed in the thread https://sourceforge.net/forum/forum.php?thread_id=837375&forum_id=37108
    unfortunatly there isn't posted a solution for it.

    My Environment is as follows:
    - S.u.S.E. Linux 8.2
    - KDevelop 2.1.5
    - gcc 3.3
    - autoconf 2.5.7
    - automake 1.7.2
    - libtool 1.4.3
    - CppUnit 1.9.11 portability-test4

    As stated elsewhere in this forum, i tried to throw an std::runtime_error("test") instead of calling CPPUNIT_ASSERT(false). The result is the same as bevor.

    Please can someone tell me, if there is a workaround or circumvention of this problem. Otherwise i can hardly use cppunit to test my application. Maybe there is a system- or compiler-setting, that i have overlooked.

    With best regards,
    J. Kaesser

     
    • Nick Bova

      Nick Bova - 2003-11-26

      HI

      It seems I know how to fix this proble.
      (But don't know exactly, why).

      try{
        CPPUNIT_ASSERT_DOUBLES_EQUAL(10,100,4);
      }catch(::std::exception &e)
      {
        ::std::cout << e.what();
      }

      Nick

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.