BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
numericutils.test.cpp File Reference

Implements class CLASS? More...

Include dependency graph for numericutils.test.cpp:

Go to the source code of this file.

Classes

class  NumericUtilsTest
 

Functions

 TEST_F (NumericUtilsTest, areAlmostEqual)
 

Detailed Description

Implements class CLASS?

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file numericutils.test.cpp.

Function Documentation

◆ TEST_F()

TEST_F ( NumericUtilsTest  ,
areAlmostEqual   
)

Definition at line 28 of file numericutils.test.cpp.

29 {
30  EXPECT_TRUE(Utils::AreAlmostEqual(0.0, 0.0));
31  EXPECT_TRUE(Utils::AreAlmostEqual(1.0, 1.0));
32  EXPECT_TRUE(Utils::AreAlmostEqual(10.0 / 100.0, 100.0 / 1000.0));
33  EXPECT_TRUE(Utils::AreAlmostEqual(std::sin(0.0), 0.0));
34  EXPECT_FALSE(Utils::AreAlmostEqual(std::cos(0.0), 0.0));
35 }
MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor=1.0)
Returns true if two doubles agree within epsilon*tolerance.

References ModelView::Utils::AreAlmostEqual().

Here is the call graph for this function: