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
"
16
#include "
mvvm/utils/numericutils.h
"
17
#include <cmath>
18
19
using namespace
ModelView
;
20
21
class
NumericUtilsTest
:
public
::testing::Test {
22
public
:
23
~NumericUtilsTest
();
24
};
25
26
NumericUtilsTest::~NumericUtilsTest
() =
default
;
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
}
NumericUtilsTest
Definition:
numericutils.test.cpp:21
NumericUtilsTest::~NumericUtilsTest
~NumericUtilsTest()
google_test.h
Defines class CLASS?
ModelView::Utils::AreAlmostEqual
MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor=1.0)
Returns true if two doubles agree within epsilon*tolerance.
Definition:
numericutils.cpp:23
ModelView
materialitems.h Collection of materials to populate MaterialModel.
Definition:
importtablewidget.h:26
numericutils.h
Defines class CLASS?
TEST_F
TEST_F(NumericUtilsTest, areAlmostEqual)
Definition:
numericutils.test.cpp:28
mvvm
tests
testmodel
numericutils.test.cpp
Generated by
1.9.1