Index: trunk/tests/test_FejerQuadrature.cc =================================================================== --- trunk/tests/test_FejerQuadrature.cc (revision 574) +++ trunk/tests/test_FejerQuadrature.cc (revision 575) @@ -1,50 +1,59 @@ #include #include #include #include "UnitTest++.h" #include "test_utils.hh" + #include "npstat/nm/FejerQuadrature.hh" +#include "npstat/nm/SimpleFunctors.hh" using namespace npstat; using namespace std; namespace { struct MyPoly : public Functor1 { long double operator()(const long double& x) const {return x*x*x*x*x - 11*x*x*x - 2*x*x + 3*x - 7;} }; TEST(FejerQuadrature) { const unsigned nsup[] = {6, 8, 11, 12, 16, 32, 64}; for (unsigned icycle=0; icycle w(nsup[icycle]); quad.getWeights(&w[0], w.size()); long double sum = 0.0L; for (int k=w.size()-1; k>=0; --k) sum += w[k]; CHECK_CLOSE(2.0L, sum, 1.e-16L); const long double v = quad.integrate(MyPoly(), 0.L, 4.L); CHECK_CLOSE(-68.0L, v, 1.e-14); } } TEST(FejerQuadrature_minimalExactRule) { for (unsigned i=0; i<10000; ++i) { const unsigned deg = test_rng()*1000; const unsigned npt = FejerQuadrature::minimalExactRule(deg); CHECK(npt == deg+1U); } } + + TEST(FejerQuadrature_minPoints) + { + FejerQuadrature fej(1); + CHECK_CLOSE(12.0, fej.integrate(ConstValue1(3.0), + -1.L, 3.L), 1.e-15); + } }