1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/CONCEPT/classTest.h>
///////////////////////////
// insert includes here
#include <BALL/STRUCTURE/radialDistributionFunction.h>
///////////////////////////
START_TEST(RadialDistributionFunction)
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
using namespace BALL;
/// insert tests for each member function here
///
Coefficients coef;
vector<Coefficients> coefs;
vector<Interval> intervals;
coef.push_back(0.0); coef.push_back(0.0);
coef.push_back(0.0); coef.push_back(0.0);
coefs.push_back(coef);
coef.clear();
coef.push_back(3.0); coef.push_back(1.0);
coef.push_back(0.0); coef.push_back(0.0);
coefs.push_back(coef);
coef.clear();
coef.push_back(0.0); coef.push_back(0.0);
coef.push_back(0.0); coef.push_back(3.0);
coefs.push_back(coef);
coef.clear();
intervals.push_back(Interval(0.0, 1.0));
intervals.push_back(Interval(1.0, 2.0));
intervals.push_back(Interval(2.0, 3.0));
PiecewisePolynomial poly(4, intervals, coefs);
RadialDistributionFunction* RDFp;
CHECK(RadialDistributionFunction::RadialDistributionFunction())
RDFp = new RadialDistributionFunction();
TEST_NOT_EQUAL(RDFp, 0)
RESULT
CHECK(RadialDistributionFunction::~RadialDistributionFunction())
delete RDFp;
RESULT
CHECK(RadialDistributionFunction::RadialDistributionFunction(const RadialDistributionFunction& rdf))
RadialDistributionFunction RDF2(poly);
RadialDistributionFunction RDF(RDF2);
TEST_EQUAL(RDF.getRepresentation().getDegree(), 4);
bool test = (RDF.getRepresentation().getIntervals() == intervals);
TEST_EQUAL(test, true)
test = (RDF.getRepresentation().getCoefficients() == coefs);
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::RadialDistributionFunction(const PiecewisePolynomial& polynomial))
RadialDistributionFunction RDF(poly);
TEST_EQUAL(RDF.getRepresentation().getDegree(), 4)
bool test = (RDF.getRepresentation().getIntervals() == intervals);
TEST_EQUAL(test, true)
test = (RDF.getRepresentation().getCoefficients() == coefs);
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::clear())
RadialDistributionFunction RDF(poly);
RDF.clear();
TEST_EQUAL(RDF.getRepresentation().getDegree(), 0)
std::vector<Interval> nope;
bool test = (RDF.getRepresentation().getIntervals() == nope);
TEST_EQUAL(test, true)
std::vector<Coefficients> naught;
test = (RDF.getRepresentation().getCoefficients() == naught);
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::RadialDistributionFunction& operator =
(const RadialDistributionFunction& rdf))
RadialDistributionFunction RDF;
RadialDistributionFunction RDF2(poly);
RDF = RDF2;
TEST_EQUAL(RDF.getRepresentation().getDegree(), 4)
bool test = (RDF.getRepresentation().getIntervals() == intervals);
TEST_EQUAL(test, true)
std::vector<Coefficients> naught;
test = (RDF.getRepresentation().getCoefficients() == coefs);
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::setRepresentation(const PiecewisePolynomial& polynomial))
RadialDistributionFunction RDF;
RDF.setRepresentation(poly);
TEST_EQUAL(RDF.getRepresentation().getDegree(), 4)
bool test = (RDF.getRepresentation().getIntervals() == intervals);
TEST_EQUAL(test, true)
std::vector<Coefficients> naught;
test = (RDF.getRepresentation().getCoefficients() == coefs);
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::getRepresentation() const )
RadialDistributionFunction RDF;
RDF.setRepresentation(poly);
TEST_EQUAL(RDF.getRepresentation().getDegree(), 4)
bool test = (RDF.getRepresentation().getIntervals() == intervals);
TEST_EQUAL(test, true)
std::vector<Coefficients> naught;
test = (RDF.getRepresentation().getCoefficients() == coefs);
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::getRange() const )
RadialDistributionFunction RDF(poly);
bool test = (RDF.getRange() == poly.getRange());
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::double operator () (double x) const )
RadialDistributionFunction RDF(poly);
TEST_REAL_EQUAL(RDF(0.5), 0.0)
TEST_REAL_EQUAL(RDF(1.0), 3.0)
TEST_REAL_EQUAL(RDF(1.5), 3.5)
TEST_REAL_EQUAL(RDF(2.5), 0.375)
TEST_REAL_EQUAL(RDF(6.0), 0.0)
RESULT
CHECK(RadialDistributionFunction::isInRange(double x) const )
RadialDistributionFunction RDF(poly);
bool test = (RDF.isInRange(2) == poly.isInRange(2));
test = (RDF.isInRange(7) == poly.isInRange(7));
TEST_EQUAL(test, true)
RESULT
CHECK(RadialDistributionFunction::isValid())
RadialDistributionFunction RDF(poly);
bool test = (RDF.isValid() == poly.isValid());
TEST_EQUAL(test, true)
RESULT
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
|