diff --git a/dune/stuff/test/common_float_cmp.cc b/dune/stuff/test/common_float_cmp.cc index 9aced8a44e2f19a4228622377c9af6d96f53d9ac..f78dc1b2d825d763f340a43b30e3ef3b835df0ee 100644 --- a/dune/stuff/test/common_float_cmp.cc +++ b/dune/stuff/test/common_float_cmp.cc @@ -13,8 +13,8 @@ #include <dune/common/fvector.hh> #include <dune/stuff/common/float_cmp.hh> +#include <dune/stuff/test/float_cmp.hh> #include <dune/stuff/common/fvector.hh> -#include <dune/stuff/common/vector.hh> #include <dune/stuff/la/container/common.hh> #include <dune/stuff/la/container/eigen.hh> #include <dune/stuff/la/container/istl.hh> @@ -49,25 +49,25 @@ struct FloatCmpBase : public testing::Test void check_eq() { - EXPECT_TRUE(Stuff::Common::FloatCmp::eq(zero, zero)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<numpy>(zero, zero)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<relativeWeak>(zero, zero)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<relativeStrong>(zero, zero)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<absolute>(zero, zero)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<defaultStyle>(zero, zero)); - - EXPECT_TRUE(Stuff::Common::FloatCmp::eq(zero, 0.9 * epsilon)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<numpy>(zero, 0.9 * epsilon)); + DSC_EXPECT_FLOAT_EQ(zero, zero); + DSC_EXPECT_FLOAT_EQ<numpy>(zero, zero); + DSC_EXPECT_FLOAT_EQ<relativeWeak>(zero, zero); + DSC_EXPECT_FLOAT_EQ<relativeStrong>(zero, zero); + DSC_EXPECT_FLOAT_EQ<absolute>(zero, zero); + DSC_EXPECT_FLOAT_EQ<defaultStyle>(zero, zero); + + DSC_EXPECT_FLOAT_EQ(zero, 0.9 * epsilon); + DSC_EXPECT_FLOAT_EQ<numpy>(zero, 0.9 * epsilon); EXPECT_FALSE(Stuff::Common::FloatCmp::eq<relativeWeak>(zero, 0.9 * epsilon)); /* <- NOTE */ EXPECT_FALSE(Stuff::Common::FloatCmp::eq<relativeStrong>(zero, 0.9 * epsilon)); /* <- NOTE */ - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<absolute>(zero, 0.9 * epsilon)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<defaultStyle>(zero, 0.9 * epsilon)); + DSC_EXPECT_FLOAT_EQ<absolute>(zero, 0.9 * epsilon); + DSC_EXPECT_FLOAT_EQ<defaultStyle>(zero, 0.9 * epsilon); EXPECT_FALSE(Stuff::Common::FloatCmp::eq(zero, 1.1 * epsilon)); EXPECT_FALSE(Stuff::Common::FloatCmp::eq<numpy>(zero, 1.1 * epsilon)); EXPECT_FALSE(Stuff::Common::FloatCmp::eq<relativeWeak>(zero, 1.1 * epsilon)); EXPECT_FALSE(Stuff::Common::FloatCmp::eq<relativeStrong>(zero, 1.1 * epsilon)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<absolute>(zero, 1.1 * epsilon)); /* <- NOTE */ + DSC_EXPECT_FLOAT_EQ<absolute>(zero, 1.1 * epsilon); /* <- NOTE */ EXPECT_FALSE(Stuff::Common::FloatCmp::eq<defaultStyle>(zero, 1.1 * epsilon)); EXPECT_FALSE(Stuff::Common::FloatCmp::eq(zero, one)); @@ -78,19 +78,19 @@ struct FloatCmpBase : public testing::Test EXPECT_FALSE(Stuff::Common::FloatCmp::eq<defaultStyle>(zero, one)); const auto eps_plus = one + 0.9 * epsilon; - EXPECT_TRUE(Stuff::Common::FloatCmp::eq(one, eps_plus)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<numpy>(one, eps_plus)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<relativeWeak>(one, eps_plus)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<relativeStrong>(one, eps_plus)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<absolute>(one, eps_plus)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<defaultStyle>(one, eps_plus)); - - EXPECT_TRUE(Stuff::Common::FloatCmp::eq(one, one + 1.1 * epsilon)); /* <- NOTE */ - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<numpy>(one, one + 1.1 * epsilon)); /* <- NOTE */ + DSC_EXPECT_FLOAT_EQ(one, eps_plus); + DSC_EXPECT_FLOAT_EQ<numpy>(one, eps_plus); + DSC_EXPECT_FLOAT_EQ<relativeWeak>(one, eps_plus); + DSC_EXPECT_FLOAT_EQ<relativeStrong>(one, eps_plus); + DSC_EXPECT_FLOAT_EQ<absolute>(one, eps_plus); + DSC_EXPECT_FLOAT_EQ<defaultStyle>(one, eps_plus); + + DSC_EXPECT_FLOAT_EQ(one, one + 1.1 * epsilon); /* <- NOTE */ + DSC_EXPECT_FLOAT_EQ<numpy>(one, one + 1.1 * epsilon); /* <- NOTE */ EXPECT_FALSE(Stuff::Common::FloatCmp::eq<relativeWeak>(one, one + 1.1 * epsilon)); EXPECT_FALSE(Stuff::Common::FloatCmp::eq<relativeStrong>(one, one + 1.1 * epsilon)); - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<absolute>(one, one + 1.1 * epsilon)); /* <- NOTE */ - EXPECT_TRUE(Stuff::Common::FloatCmp::eq<defaultStyle>(one, one + 1.1 * epsilon)); /* <- NOTE */ + DSC_EXPECT_FLOAT_EQ<absolute>(one, one + 1.1 * epsilon); /* <- NOTE */ + DSC_EXPECT_FLOAT_EQ<defaultStyle>(one, one + 1.1 * epsilon); /* <- NOTE */ EXPECT_FALSE(Stuff::Common::FloatCmp::eq(one, 2. * one)); EXPECT_FALSE(Stuff::Common::FloatCmp::eq<numpy>(one, 2. * one)); diff --git a/dune/stuff/test/main.hxx b/dune/stuff/test/main.hxx index 800f922601c1038b4dc1796d04fd37b4d455a21f..16262e60de2ed0072f866ba0b5c5cb082efe43bc 100644 --- a/dune/stuff/test/main.hxx +++ b/dune/stuff/test/main.hxx @@ -45,6 +45,7 @@ #include <dune/stuff/common/timedlogging.hh> #include <dune/stuff/common/convergence-study.hh> #include <dune/stuff/common/parallel/threadmanager.hh> +#include <dune/stuff/common/vector.hh> #include "common.hh"