Go to the documentation of this file.00001
00008
00009
00010
00011
00012 #include <gtest/gtest.h>
00013 #include "../../include/ecl/math/fuzzy.hpp"
00014
00015
00016
00017
00018
00019 TEST(FuzzyTests,isApprox) {
00020 EXPECT_TRUE(ecl::isApprox(3.0,3.0000000000000001));
00021 EXPECT_FALSE(ecl::isApprox(3.0,3.1000000000000001));
00022 EXPECT_TRUE(ecl::isApprox(3,3.0000000000000001));
00023 EXPECT_FALSE(ecl::isApprox(3,3.1000000000000001));
00024 EXPECT_TRUE(ecl::isApprox(3.0000000000000001,3));
00025 EXPECT_FALSE(ecl::isApprox(3.1000000000000001,3));
00026 }
00027
00028 TEST(FuzzyTests,isApproxOrLessThan) {
00029 EXPECT_TRUE(ecl::isApproxOrLessThan(3.0,3.0000000000000001));
00030 EXPECT_TRUE(ecl::isApproxOrLessThan(2.0,3.0000000000000001));
00031 EXPECT_FALSE(ecl::isApproxOrLessThan(4.0,3.0000000000000001));
00032 EXPECT_TRUE(ecl::isApproxOrLessThan(3,3.0000000000000001));
00033 EXPECT_TRUE(ecl::isApproxOrLessThan(2,3.0000000000000001));
00034 EXPECT_FALSE(ecl::isApproxOrLessThan(4,3.0000000000000001));
00035 EXPECT_TRUE(ecl::isApproxOrLessThan(3.0000000000000001,3));
00036 EXPECT_FALSE(ecl::isApproxOrLessThan(3.0000000000000001,2));
00037 EXPECT_TRUE(ecl::isApproxOrLessThan(3.0000000000000001,4));
00038 }
00039
00040
00041
00042
00043
00044 int main(int argc, char **argv) {
00045 testing::InitGoogleTest(&argc,argv);
00046 return RUN_ALL_TESTS();
00047 }
00048