← Back to team overview

dolfin team mailing list archive

Re: [Bug 425729] [NEW] Function unit test fails on Windows

 

logg wrote:
> On Mon, Sep 07, 2009 at 01:56:58PM -0000, Johannes Ring wrote:
>> Public bug reported:
>>
>> Hi,
>>
>> When running the function unit test on Windows I get a failure:
>>
>> C:\fenicsslave\src\dolfin\test\unit\function\cpp>test
>> test.cpp:60:Assertion
>> Test name: Eval::testArbitraryEval
>> assertion failed
>> - Expression: u[0] == sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])
>>
>> Failures !!!
>> Run: 1   Failure total: 1   Failures: 1   Errors: 0
>>
>> I have printed both expressions and they seem to be the same but
>> CPPUNIT_ASSERT still reports a failure. A simple fix is to use
>> CPPUNIT_ASSERT_EQUAL instead of CPPUNIT_ASSERT:
>>
>>
>>      // Test evaluation of a user-defined function
>>      f0.eval(&u[0], data);
>> -    CPPUNIT_ASSERT(u[0] == sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]));
>> +    CPPUNIT_ASSERT_EQUAL(u[0], sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]));
>>
>>  #ifdef HAS_GTS
>>      // Test evaluation of a discrete function
>>
>> Johannes
>>
>> ** Affects: dolfin
>>      Importance: Undecided
>>          Status: New
> 
> Strange. Is there any difference between the two? Like a tolerance for
> round-off error in CPP_ASSERT_EQUAL?
>

We should probably use

    CPPUNIT_ASSERT_DOUBLES_EQUAL

See

http://cppunit.sourceforge.net/doc/lastest/group___assertions.html#ga5

Garth

> Anyway, the fix looks ok so just push it.
> 
> --
> Anders
>

-- 
Function unit test fails on Windows
https://bugs.launchpad.net/bugs/425729
You received this bug notification because you are subscribed to DOLFIN.

Status in DOLFIN: New

Bug description:
Hi,

When running the function unit test on Windows I get a failure:

C:\fenicsslave\src\dolfin\test\unit\function\cpp>test
test.cpp:60:Assertion
Test name: Eval::testArbitraryEval
assertion failed
- Expression: u[0] == sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2])

Failures !!!
Run: 1   Failure total: 1   Failures: 1   Errors: 0

I have printed both expressions and they seem to be the same but CPPUNIT_ASSERT still reports a failure. A simple fix is to use CPPUNIT_ASSERT_EQUAL instead of CPPUNIT_ASSERT:


     // Test evaluation of a user-defined function
     f0.eval(&u[0], data);
-    CPPUNIT_ASSERT(u[0] == sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]));
+    CPPUNIT_ASSERT_EQUAL(u[0], sin(3.0*x[0])*sin(3.0*x[1])*sin(3.0*x[2]));

 #ifdef HAS_GTS
     // Test evaluation of a discrete function

Johannes


References