BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
numericutils.test.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/tests/testmodel/numericutils.test.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #include "google_test.h"
17 #include <cmath>
18 
19 using namespace ModelView;
20 
21 class NumericUtilsTest : public ::testing::Test {
22 public:
24 };
25 
27 
28 TEST_F(NumericUtilsTest, areAlmostEqual)
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 }
Defines class CLASS?
MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor=1.0)
Returns true if two doubles agree within epsilon*tolerance.
materialitems.h Collection of materials to populate MaterialModel.
Defines class CLASS?
TEST_F(NumericUtilsTest, areAlmostEqual)