cppunit-devel Mailing List for CppUnit - C++ port of JUnit (Page 3)
Brought to you by:
blep
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
(21) |
May
(96) |
Jun
(109) |
Jul
(42) |
Aug
(6) |
Sep
(106) |
Oct
(60) |
Nov
(20) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(7) |
Feb
(11) |
Mar
(49) |
Apr
(124) |
May
(30) |
Jun
(37) |
Jul
(53) |
Aug
(33) |
Sep
(21) |
Oct
(22) |
Nov
(19) |
Dec
(15) |
2003 |
Jan
(34) |
Feb
(25) |
Mar
(11) |
Apr
(12) |
May
(16) |
Jun
(24) |
Jul
(23) |
Aug
(23) |
Sep
(42) |
Oct
(7) |
Nov
(32) |
Dec
(33) |
2004 |
Jan
(41) |
Feb
(41) |
Mar
(24) |
Apr
(25) |
May
(18) |
Jun
(13) |
Jul
(11) |
Aug
(15) |
Sep
(22) |
Oct
(10) |
Nov
(15) |
Dec
(9) |
2005 |
Jan
(4) |
Feb
(15) |
Mar
(11) |
Apr
(16) |
May
(29) |
Jun
(17) |
Jul
(27) |
Aug
(12) |
Sep
(9) |
Oct
(10) |
Nov
(5) |
Dec
(6) |
2006 |
Jan
(2) |
Feb
(6) |
Mar
(7) |
Apr
(2) |
May
(1) |
Jun
(5) |
Jul
(8) |
Aug
(6) |
Sep
(10) |
Oct
(11) |
Nov
(15) |
Dec
(2) |
2007 |
Jan
(12) |
Feb
(22) |
Mar
(10) |
Apr
(7) |
May
(1) |
Jun
(8) |
Jul
(4) |
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: CppUnit d. m. l. <cpp...@li...> - 2007-03-03 23:03:01
|
Hi, I am trying to create tests for database plugins for my library. I have 3 plugins. Every one of them is tested using the same tests cases. I want to create one main suite, that is responsible for plugin initialization and creation of database schema for tests. I want to add arbitrary number of test cases (derived from CppUnit::TestCase) to the main suite and run it. Every test case needs to know handle to database plugin and connection parameters, which are owned by main suite. So far I created following structure: //main test suite class DbPluginTestSuite : public CppUnit::TestSuite { void init(); Database* mDb; const char* mConnParams; }; //base class for test cases class Db_TestBase : public CppUnit::TestCase { public: void setParams(Database* pDb, const char* pConnParams); protected: Database* mDb; const char* mConnParams; }; //example test case class Db_Basic : public Db_TestBase { CPPUNIT_TEST_SUITE() CPPUNIT_TEST(someTest) CPPUNIT_TEST_SUITE_END(); public: void someTest() //uses mDb and mConnParams from parent class }; I am trying to run tests like this: CppUnit::TextTestRunner runner; DbPluginTestSuite* mainSuite = new DbPluginTestSuite(); mainSuite->init(); Db_testBase* tc = new Db_Basic(); tc->setParams(mainSuite->mDb,mainSuite->mConnParams) mainSuite ->addTest(tc); //BAD runner.addTest(mainSuite); Line marked BAD causes tc to be added to suite, but only first test is called. I cannot use Db_Basic::suite(), because this method creates new uninitialized object. I think that I need to create TestSuite using existing TestCase pointer (tc) and pass it to mainSuite->addTest(). Is there any way to do it? Thanks for help, Łukasz |
From: CppUnit d. m. l. <cpp...@li...> - 2007-03-03 15:13:04
|
> An easier fix is to have floatingPointIsFinite() return an int, since > that is what isfinite(), finite() and _finite() all do. You're right ! Could someone commit that, please ? Vincent Rivière vri...@us... |
From: CppUnit d. m. l. <cpp...@li...> - 2007-03-02 20:46:23
|
I'm trying to install cppunit and I am having a problem compiling and activating TestRunnerDspPlugin.dll Sometimes when I build I get a link error. Sometimes I don't. But the TestRunnerDspPlugin.dll is nowhere to be found. Can you provide any direction. OH, sorry. using the 1.12 version. Carl Mueller The information transmitted is intended only for the person(s)or entity to which it is addressed and may contain confidential and/or legally privileged material. Delivery of this message to any person other than the intended recipient(s) is not intended in any way to waive privilege or confidentiality. Any review, retransmission, dissemination or other use of , or taking of any action in reliance upon, this information by entities other than the intended recipient is prohibited. If you receive this in error, please contact the sender and delete the material from any computer. For Translation: http://www.baxter.com/email_disclaimer |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-27 22:38:44
|
Vincent, An easier fix is to have floatingPointIsFinite() return an int, since that is what isfinite(), finite() and _finite() all do. -Steve |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-27 21:29:27
|
Vincent, An easier fix is to have floatingPointIsFinite() return an int, since that is what isfinite(), finite() and _finite() all do. -Steve |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-27 20:46:05
|
Hello. There is a new compilation warning with MSVC6 : TestAssert.cpp f:\sourceforge\cppunit\cppunit\include\cppunit\portability\floatingpoint.h(42) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) The cause is in cppunit/include/cppunit/portability/FloatingPoint.h function floatingPointIsFinite() #elif defined(CPPUNIT_HAVE__FINITE) return _finite(x); #else The _finite() return value is an int. Furthermore, casting to bool is not enough to remove the warning. The above line could be fixed with : return _finite(x) ? true : false; Could someone check this in please ? Vincent Rivière vri...@us... |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-26 20:18:34
|
Hi Baptiste, The configure test for isfinite() is performed by compiling with C++ compiler and linking with -lm. See config/ax_cxx_have_isfinite.m4 for the macro itself, and see config.log for the detailed output. I'm very surprised that it is detected at configure time but the function is not defined at compile time. Can you check carefully config.log and to see whether different compiler options might account for this? The only other thing that comes to mind is that the real code is inside namespace CppUnit, whereas the configure test is not. Do we need to qualify it to ::isfinite()? Puzzled, -Steve |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-26 08:10:50
|
Compilation of CppUnit currently fails on both Solaris 10 (CC 5.8) & Suse Linux 9.3 (g++ 3.3.5). configure detects either isfinite() or finite(), but compilation fails when attempting to use that function in CppUnit. Below are the relevant part of configure/config-auto and compilation failure message. I don't know how configure detects the presence of those function, but my guess is that it is not done the same way as we compile CppUnit. Linux man page state that isfinite() is only available in standard C99 mode (which does not seem to be combinable with C++). Solaris man page state that finite() requires include of <ieeefp.h>. isfinite() is also present but I guess it is also only when compiling C (did not manage to use it by changing the code). Are the configure tests compiled in C or C++? Here is the relevant data: * Suse Linux 9.3 with g++ 3.3.5: - configure: checking for isfinite... yes checking for finite... yes - config-auto.h matches configure output: /* Define to 1 if you have the `finite' function. */ #ifndef CPPUNIT_HAVE_FINITE #define CPPUNIT_HAVE_FINITE 1 #endif /* define if compiler has isfinite */ #ifndef CPPUNIT_HAVE_ISFINITE #define CPPUNIT_HAVE_ISFINITE 1 #endif - but compilation fails: g++ -DHAVE_CONFIG_H -I. -I../../../src/cppunit -I../../config -I../../include - I../../../include -g -O2 -MT TestAssert.lo -MD -MP -MF .deps/TestAssert.Tpo -c . ./../../src/cppunit/TestAssert.cpp -fPIC -DPIC -o .libs/TestAssert.o In file included from ../../../src/cppunit/TestAssert.cpp:2: ../../../include/cppunit/portability/FloatingPoint.h: In function `bool CppUnit::floatingPointIsFinite(double)': ../../../include/cppunit/portability/FloatingPoint.h:38: error: `isfinite' undeclared (first use this function) ../../../include/cppunit/portability/FloatingPoint.h:38: error: (Each undeclared identifier is reported only once for each function it appears in.) * Solaris 10 (CC 5.8): - configure: checking for isfinite... no checking for finite... yes - config-auto.h matches configure output: /* Define to 1 if you have the `finite' function. */ #ifndef CPPUNIT_HAVE_FINITE #define CPPUNIT_HAVE_FINITE 1 #endif /* define if compiler has isfinite */ /* #undef CPPUNIT_HAVE_ISFINITE */ - but compilation fails: CC -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -pta -mt -xtarget=generic -g -features=no%transitions -xildoff -c TestAssert.cpp -o TestAssert.o "../../include/cppunit/portability/FloatingPoint.h", line 40: Error: The function "finite" must have a prototype. 1 Error(s) detected. Baptiste. --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 12:26:18
|
Did it crash ? If so it means that there is something seriously wrong on = your platform.=20 Are you using on the gcc version with broken exception handling ? (see = http://llvm.org/docs/GettingStarted.html#brokengcc). Baptiste. ----- Original Message -----=20 From: CppUnit development mailing list=20 To: cpp...@li...=20 Sent: Thursday, January 18, 2007 12:29 PM Subject: [Cppunit-devel] Problem coming with CPPUNIT when using Linux Hi,=20 I am building the CPPUNIT on linux i have followed the following steps to build it .. STEPS 1. ./configure 2. make 3. make check 4. make install Now when i am at step 3 i.e when giving the command "make check" i am recieveing the following on my computer screen ... =20 TestResultCollectorTest::testWasSuccessfulWithErrorsAndFailures : OK TestResultCollectorTest::testWasSuccessfulWithSuccessfulTest : OK TestResultCollectorTest::testSynchronizationAddFailure : OK TestResultCollectorTest::testSynchronizationStartTest : OK=20 TestResultCollectorTest::testSynchronizationRunTests : OK TestResultCollectorTest::testSynchronizationTestErrors : OK TestResultCollectorTest::testSynchronizationTestFailures : OK TestResultCollectorTest::testSynchronizationFailures : OK=20 TestResultCollectorTest::testSynchronizationWasSuccessful : OK TestResultTest::testConstructor : OK TestResultTest::testStop : OK TestResultTest::testAddError =20 after printing the last statement here i.e " = TestResultTest::testAddError" , it does not move ahead ... and i am not = able to go to step 4 i.e "check install" I would be highly obliged if you can provide me the solution to tackle = this problem ... Regards, Gaurav Bhateja ..=20 --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:45:03
|
Yes you can. See examples\simple\simple_plugin.dsp for an example of = this. The DllPlugInTester what created just for this. Baptiste. ----- Original Message -----=20 From: CppUnit development mailing list=20 To: cpp...@li...=20 Sent: Thursday, February 22, 2007 12:14 PM Subject: [Cppunit-devel] How to do this ? Hi, I had heard about CPPUnit long time back and wanted to use it in my = project. i used the mfc samples and found it to be exciting. However, I have a few queries regarding one feature of CppUnit = "Compiler-like text output to integrate with an IDE". the mfc sample which i used, will pop up the testcase UI only when we = Run the application. can the feature be used during developing dlls and services ? i.e is = it possible to display the results of the Test cases when we = compile/build a dll rather than executing it ? if yes, please let me know "how" Thanks, Nidhish --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:42:22
|
CppUnit development mailing list wrote: > Hello, > > I currently have my test driver code declared in in a .h file, the > following code is said to have a global, but clearly does not: I can't figure out what you are talking about. What global and detector are you talking about ? > void UMDIOTraceTest::testHasMoreRecords() > { > // Test with a valid trace > UMDIOTrace test(1, "tests/support/umd_io_trace.tra"); > for (int i = 0; i < 10; i++) > { > CPPUNIT_ASSERT(true == test.hasMoreRecords()); > test.nextRecordAsMessage(); > } > > CPPUNIT_ASSERT(false == test.hasMoreRecords()); > } > > I think simply because the variable is in the header file (i.e. > inline), your detector must be getting confused. > > Cheers, > Brad --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:40:18
|
CppUnit development mailing list wrote: > What is a 7-zip file? > I assume it's a compressed archive. > How do uncompress? Search engines are your friend: http://www.7-zip.org/ > regards > Gilbert Semmer --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:38:57
|
CppUnit development mailing list wrote: > Hi cppunit developers and users! > > I have a question about test execution. I have a test suit as shown > below with two test methods. The code is then compiled into a dll > and I run it with this command: > > DllPlugInTesterd_dll.exe -c plugin_d.dll > > I now have the following problem. During startup cppunit creates two > instances of the ExampleTest class. Then it calls setup(), > sampleTest() > and finally teardown(). Then it does the same on the second instance > with the method sampleTest2(). Each test case has its own instance to ensure each test case execution is independent. > This looks quite strange. I thought I could initialize some class in > the setup method which is then shared between all the different test > method calls? > > The reason why I would like to share an instance between them is that > I > have to start an external program during test execution (which takes > very long and therefore should not be started and killed for each test > method invocation). I therefore used a shared pointer which I thought > would be accessible for all test invocations. But since each > invocation > uses a different instance this does not work. Possible solutions I see are: - make a single test case and add log to know which "internal" test case failed (see ClockerPlugIn as an example to integrate a listener listener hook with test result). Downside is you won't get precise reporting of what failed in the results without reading the log. - make your "shared" instance static. Though, you would still need to figure out when to clean it up. Thinking about it, may be you could use a rough algorithm: if last executed test did not ask for it, then destroy the shared instance. Makes the component that managed the "shared" instance a test listener. Baptiste. > Any suggestions how this should be done would be really great! > > Please also tell me if what I wrote / want is unclear > > Thanks a lot, Fabian --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:25:30
|
This mecanism is not supported, but you can implement your own test = factory in a TestSuite subclass. Baptiste. ----- Original Message -----=20 From: CppUnit development mailing list=20 To: cpp...@li...=20 Sent: Wednesday, January 31, 2007 9:18 PM Subject: [Cppunit-devel] Question about cppUnit Folks - =20 I am a novice user of cppUnit but a pretty experienced one of JUnit & = MbUnit. I was wondering if one of you could provide an answer to the = following query: =20 JUnit & MbUnit have the capability to loop over test cases defined in = XML files, parse them, dynamically create test cases and run these test = cases using their respective runners - I was wondering if cppUnit = offered the same capability so that I could refrain from statically = defining all my test cases. This would permit me to execute the same = sequence of test steps though with disparate data defined in these XML = files =20 Any hints, suggestions will be greatly appreciated. =20 Thanks --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:17:18
|
CppUnit development mailing list wrote: > Hello, > I think I have found a small bug in the CppUnit Cookbook: > > http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html > > Section: TestRunner > in the code example is: > > static CppUnit::Test *suite() > > and should be > > static CppUnit:: TestSuite *suite() The helper macros for registration and the addTest() method will accept anything from Test* to TestSuite*. But since the tutorial states that we return a test suite, it should be TestSuite *. > Please let me know, if I was right :-) You were. Thanks for pointing this out. Baptiste. > > Best Regards > Marcin Sochacki --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 09:04:38
|
I usually put the test creation logic in a new subclass of TestSuite, = which add tests to itself.=20 ----- Original Message -----=20 From: CppUnit development mailing list=20 To: cpp...@li...=20 Sent: Wednesday, February 21, 2007 9:52 AM Subject: [Cppunit-devel] newbie question: create tests from input file Hi, I have an input file with each line contains a specific string that I = want to check against a function that returns a boolean. How do I = create a single test for each line under cppUnit? So far, I've been = doing all this under a single test for all lines:=20 StrTest.h: class StrTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StrTest); CPPUNIT_TEST(testOpen); CPPUNIT_TEST_SUITE_END(); public: void testOpen() { string line;=20 yutString errStr; =20 ifstream dbFile("forbiddenList.txt"); if (dbFile.is_open()) { while (!dbFile.eof()) { getline(dbFile, line);=20 cout << line << endl; if (!line.empty()) CPPUNIT_ASSERT(isValidString(line, errStr) =3D=3D = true); ... strTest.cc: int main() { CppUnit::TextUi::TestRunner runner;=20 runner.addTest(StrTest::suite()); runner.run(); } Thanks -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to = share your opinions on IT & business topics through brief surveys-and earn cash = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV -------------------------------------------------------------------------= ----- _______________________________________________ Cppunit-devel mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppunit-devel |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 08:52:42
|
CppUnit development mailing list wrote: > Hi Baptiste, > > I'm unclear on what problem you are solving here. My guess is that > > CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) > > was passing when it should in fact fail. Is that the case? Yes. I should have put this first. All the following unit tests were failing: CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, 0.0, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, inf, 1.0 ) ); CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, nan, 1.0 ) ); This was caused by the fact that equal = expected == actual; always evaluated to true whenever expected or actual was a NaN. > Also: why did you make the following change in > examples/cppunittest/TestAssertTest.cpp? What does the comment mean? > > - CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, > 0.0, 1.0 ) ); > + CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, > 0.0, 1.0 ) ); // this one fails Ignore the comment, I forgot to remove it. It's done now. I hope it's clearer now. Baptiste. > Quoting CppUnit development mailing list > <cpp...@li...>: > >> This seems to confirm that MSVC6 code generator is bug (does not >> respect IEEE-754 standard in spite of what the doc claim). >> >> To work-around this, I added an explicit test for NaN value when >> testing non-finite value for equalities. Here is the function: >> // To work around this, a NaN is assumed to be detected if no strict >> ordering is found. >> inline bool floatingPointIsUnordered( double x ) >> { >> // x != x will detect a NaN on conformant platform >> // (2.0 < x && x < 1.0) will detect a NaN on non conformant >> platform: // => no ordering can be found for x. >> return (x != x) || (2.0 < x && x < 1.0); >> } > > I don't understand why this works for you. According to the standard > (see e.g. page 8 of > http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps) all > comparisons with NaN are false except "x != x", which is true. You > state that MSVC6 gets "x != x" wrong. Does it also get "x < y" wrong > and return true? > > >> I'm not an expert on floating-point manipulation & NaN. Does any one >> see anything wrong on the above implementation or the comments? > > The section of the paper referenced above also states that all > comparisons with NaN, except == and !=, are *invalid* and thus signal. > So the code you wrote is going to cause a problem if the FPU signals > are enabled. > > > If we need this function, can we rename it floatingPointIsNan()? Then > I can create suitable automakery to use the standard isnan() on > systems that have it. On that note, does MSVC6 have something like > isnan(), maybe called _isnan()? > http://msdn2.microsoft.com/en-us/library/tzthab44(VS.80).aspx > > > Cheers, > -Steve > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your opinions on IT & business topics through brief surveys-and > earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Cppunit-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppunit-devel |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-25 04:29:44
|
Hi Baptiste, I'm unclear on what problem you are solving here. My guess is that CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) was passing when it should in fact fail. Is that the case? Also: why did you make the following change in =20 examples/cppunittest/TestAssertTest.cpp? What does the comment mean? - CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, =20 0.0, 1.0 ) ); + CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, =20 0.0, 1.0 ) ); // this one fails Quoting CppUnit development mailing list =20 <cpp...@li...>: > This seems to confirm that MSVC6 code generator is bug (does not respect > IEEE-754 standard in spite of what the doc claim). > > To work-around this, I added an explicit test for NaN value when testing > non-finite value for equalities. Here is the function: > // To work around this, a NaN is assumed to be detected if no strict > ordering is found. > inline bool floatingPointIsUnordered( double x ) > { > // x !=3D x will detect a NaN on conformant platform > // (2.0 < x && x < 1.0) will detect a NaN on non conformant platform: > // =3D> no ordering can be found for x. > return (x !=3D x) || (2.0 < x && x < 1.0); > } I don't understand why this works for you. According to the standard =20 (see e.g. page 8 of =20 http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps) all =20 comparisons with NaN are false except "x !=3D x", which is true. You =20 state that MSVC6 gets "x !=3D x" wrong. Does it also get "x < y" wrong =20 and return true? > I'm not an expert on floating-point manipulation & NaN. Does any one see > anything wrong on the above implementation or the comments? The section of the paper referenced above also states that all =20 comparisons with NaN, except =3D=3D and !=3D, are *invalid* and thus signal.= =20 So the code you wrote is going to cause a problem if the FPU signals =20 are enabled. If we need this function, can we rename it floatingPointIsNan()? Then =20 I can create suitable automakery to use the standard isnan() on =20 systems that have it. On that note, does MSVC6 have something like =20 isnan(), maybe called _isnan()? http://msdn2.microsoft.com/en-us/library/tzthab44(VS.80).aspx Cheers, -Steve |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-24 21:13:58
|
The detection of NaN in assertDoubleEquals failed on Microsoft Visual Studio 6. The implementation assumes that NaN != NaN (IEEE-754 says it should). The failure was caused by the way MSVC6 compares floating point number equality: fld qword ptr [nan] fcomp qword ptr [nan] fnstsw ax // copie fp (floating-point) status to register to ax test ah,40h // test bit 14 of ax (0x4000) => C3 of fp status register je $L18438+0B9h (00410be2) According to this doc: http://webster.cs.ucr.edu/AoA/Windows/HTML/RealArithmetic.html#1000117 C2 should be tested for "undefined" value (which I guess NaN fall into). NaN comparison works under visual studio 2005. The equality test is done as follow: fld qword ptr [ebp+10h] fcomp qword ptr [ebp+8] fnstsw ax test ah,44h // Visual Studio 2005 does test both C2 & C3... jp CppUnit::assertDoubleEquals+1B5h (4777A5h) This seems to confirm that MSVC6 code generator is bug (does not respect IEEE-754 standard in spite of what the doc claim). To work-around this, I added an explicit test for NaN value when testing non-finite value for equalities. Here is the function: // To work around this, a NaN is assumed to be detected if no strict ordering is found. inline bool floatingPointIsUnordered( double x ) { // x != x will detect a NaN on conformant platform // (2.0 < x && x < 1.0) will detect a NaN on non conformant platform: // => no ordering can be found for x. return (x != x) || (2.0 < x && x < 1.0); } I'm not an expert on floating-point manipulation & NaN. Does any one see anything wrong on the above implementation or the comments? I modified the defined implementation for isfinite() test to: /// \brief Tests if a floating-point is finite. /// @return \c true if x is neither a NaN, nor +inf, nor -inf, \c false otherwise. inline bool floatingPointIsFinite( double x ) { double testInf = x * 0.0; // Produce 0.0 if x is finite, a NaN otherwise. return testInf == 0.0 && !floatingPointIsUnordered(testInf); } Feedbacks are welcome, Baptiste. --- Baptiste Lepilleur <bl...@us...> CppUnit maintainer OpenTest and CppUnit 2 developer. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-22 21:31:09
|
Hello, I currently have my test driver code declared in in a .h file, the following code is said to have a global, but clearly does not: void UMDIOTraceTest::testHasMoreRecords() { // Test with a valid trace UMDIOTrace test(1, "tests/support/umd_io_trace.tra"); for (int i = 0; i < 10; i++) { CPPUNIT_ASSERT(true == test.hasMoreRecords()); test.nextRecordAsMessage(); } CPPUNIT_ASSERT(false == test.hasMoreRecords()); } I think simply because the variable is in the header file (i.e. inline), your detector must be getting confused. Cheers, Brad |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-22 11:14:27
|
Hi, I had heard about CPPUnit long time back and wanted to use it in my project. i used the mfc samples and found it to be exciting. However, I have a few queries regarding one feature of CppUnit "Compiler-like text output to integrate with an IDE". the mfc sample which i used, will pop up the testcase UI only when we Run the application. can the feature be used during developing dlls and services ? i.e is it possible to display the results of the Test cases when we compile/build a dll rather than executing it ? if yes, please let me know "how" Thanks, Nidhish --------------------------------- Heres a new way to find what you're looking for - Yahoo! Answers |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-21 08:52:48
|
Hi, I have an input file with each line contains a specific string that I want to check against a function that returns a boolean. How do I create a single test for each line under cppUnit? So far, I've been doing all this under a single test for all lines: StrTest.h: class StrTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StrTest); CPPUNIT_TEST(testOpen); CPPUNIT_TEST_SUITE_END(); public: void testOpen() { string line; yutString errStr; ifstream dbFile("forbiddenList.txt"); if (dbFile.is_open()) { while (!dbFile.eof()) { getline(dbFile, line); cout << line << endl; if (!line.empty()) CPPUNIT_ASSERT(isValidString(line, errStr) == true); ... strTest.cc: int main() { CppUnit::TextUi::TestRunner runner; runner.addTest(StrTest::suite()); runner.run(); } Thanks |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-12 18:33:16
|
Hi cppunit developers and users! I have a question about test execution. I have a test suit as shown below with two test methods. The code is then compiled into a dll and I run it with this command: DllPlugInTesterd_dll.exe -c plugin_d.dll I now have the following problem. During startup cppunit creates two instances of the ExampleTest class. Then it calls setup(), sampleTest() and finally teardown(). Then it does the same on the second instance with the method sampleTest2(). This looks quite strange. I thought I could initialize some class in the setup method which is then shared between all the different test method calls? The reason why I would like to share an instance between them is that I have to start an external program during test execution (which takes very long and therefore should not be started and killed for each test method invocation). I therefore used a shared pointer which I thought would be accessible for all test invocations. But since each invocation uses a different instance this does not work. Any suggestions how this should be done would be really great! Please also tell me if what I wrote / want is unclear Thanks a lot, Fabian class ExampleTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( ExampleTest ); CPPUNIT_TEST( sampleTest ); CPPUNIT_TEST( sampleTest2 ); CPPUNIT_TEST_SUITE_END(); public: void setUp(); void tearDown(); // The different test methods void sampleTest(); void sampleTest2(); }; |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-08 13:36:34
|
What is a 7-zip file? I assume it's a compressed archive. How do uncompress? regards Gilbert Semmer --- Senior Software Architect Advanced Technologies, Stryker Instruments c/o Stryker Leibinger GmbH & Co. KG Boetzinger Strasse 41 DE-79111 Freiburg, Germany Tel. +49 761 4512 457 Fax +49 761 4512 449 457 --- simple is not easy --- NOTE: This electronic message is confidential and intended solely for the use of the individuals or entities to whom it is addressed. |
From: CppUnit d. m. l. <cpp...@li...> - 2007-02-05 15:31:51
|
Hello, I think I have found a small bug in the CppUnit Cookbook: http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html Section: TestRunner in the code example is: static CppUnit::Test *suite() and should be static CppUnit:: TestSuite *suite() Please let me know, if I was right :-) Best Regards Marcin Sochacki ***************************************************************************= ************* Note: If the reader of this message is not the intended recipient, or an= employee or agent responsible for delivering this message to the intended= recipient, you are hereby notified that any dissemination, distribution or= copying of this communication is strictly prohibited. If you have received= this communication in error, please notify us immediately by replying to= the message and deleting it from your computer. Thank you.=0D ***************************************************************************= ************* |