Ignore:
Timestamp:
Apr 6, 2011, 4:05:08 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
681d36
Parents:
1b1ba8
git-author:
Frederik Heber <heber@…> (04/06/11 15:34:43)
git-committer:
Frederik Heber <heber@…> (04/06/11 16:05:08)
Message:

FIX: last test in ChronosTest::dummyTest() had numerical rounding problem.

  • sequence of summing of array timings and in Chronos differed, hence we got rounding issues. Now we check against numeric_limits<double>::epsilon().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/ChronosUnitTest.cpp

    r1b1ba8 r6aa233  
    2121#include <cppunit/extensions/TestFactoryRegistry.h>
    2222#include <cppunit/ui/text/TestRunner.h>
     23
     24#include <limits>
    2325
    2426#include "Chronos.hpp"
     
    124126
    125127  // check summing of times
    126   CPPUNIT_ASSERT_EQUAL( timings[0] + timings[1] + timings[2] + timings[3], Chronos::getInstance().SumUpTotalTime());
     128  CPPUNIT_ASSERT( fabs(timings[0] + timings[1] + timings[2] + timings[3]- Chronos::getInstance().SumUpTotalTime()) < numeric_limits<double>::epsilon());
    127129
    128130  std::cout << Chronos::getInstance() << std::endl;
Note: See TracChangeset for help on using the changeset viewer.