fuzzy.cpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Includes
10 *****************************************************************************/
11 
12 #include <gtest/gtest.h>
13 #include "../../include/ecl/math/fuzzy.hpp"
14 
15 /*****************************************************************************
16 ** Tests
17 *****************************************************************************/
18 
19 TEST(FuzzyTests,isApprox) {
20  EXPECT_TRUE(ecl::isApprox(3.0,3.0000000000000001));
21  EXPECT_FALSE(ecl::isApprox(3.0,3.1000000000000001));
22  EXPECT_TRUE(ecl::isApprox(3,3.0000000000000001));
23  EXPECT_FALSE(ecl::isApprox(3,3.1000000000000001));
24  EXPECT_TRUE(ecl::isApprox(3.0000000000000001,3));
25  EXPECT_FALSE(ecl::isApprox(3.1000000000000001,3));
26 }
27 
28 TEST(FuzzyTests,isApproxOrLessThan) {
29  EXPECT_TRUE(ecl::isApproxOrLessThan(3.0,3.0000000000000001));
30  EXPECT_TRUE(ecl::isApproxOrLessThan(2.0,3.0000000000000001));
31  EXPECT_FALSE(ecl::isApproxOrLessThan(4.0,3.0000000000000001));
32  EXPECT_TRUE(ecl::isApproxOrLessThan(3,3.0000000000000001));
33  EXPECT_TRUE(ecl::isApproxOrLessThan(2,3.0000000000000001));
34  EXPECT_FALSE(ecl::isApproxOrLessThan(4,3.0000000000000001));
35  EXPECT_TRUE(ecl::isApproxOrLessThan(3.0000000000000001,3));
36  EXPECT_FALSE(ecl::isApproxOrLessThan(3.0000000000000001,2));
37  EXPECT_TRUE(ecl::isApproxOrLessThan(3.0000000000000001,4));
38 }
39 
40 /*****************************************************************************
41 ** Main program
42 *****************************************************************************/
43 
44 int main(int argc, char **argv) {
45  testing::InitGoogleTest(&argc,argv);
46  return RUN_ALL_TESTS();
47 }
48 
int main(int argc, char **argv)
Definition: fuzzy.cpp:44
bool isApproxOrLessThan(const Scalar &x, const OtherScalar &y, typename numeric_limits< Scalar >::Precision precision=numeric_limits< Scalar >::dummy_precision)
Checks if the first value is less than or approximate to the second.
Definition: fuzzy.hpp:172
TEST(FuzzyTests, isApprox)
Definition: fuzzy.cpp:19
bool isApprox(const Scalar &x, const OtherScalar &y, typename numeric_limits< Scalar >::Precision precision=numeric_limits< Scalar >::dummy_precision)
Checks if two values are approximate.
Definition: fuzzy.hpp:154


ecl_math
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:25