11 #ifndef TEST_INTERFACE_MODEL_H_ 12 #define TEST_INTERFACE_MODEL_H_ 18 #define BOOST_TEST_NO_MAIN 19 #define BOOST_TEST_ALTERNATIVE_INIT_API 20 #define BOOST_TEST_DYN_LINK 22 #include <boost/test/unit_test.hpp> 24 #include <boost/noncopyable.hpp> 25 #include <boost/scoped_ptr.hpp> 27 #include "eckit/config/LocalConfiguration.h" 34 #include "oops/util/DateTime.h" 35 #include "oops/util/Duration.h" 42 template <
typename MODEL>
class ModelFixture :
private boost::noncopyable {
58 return theModelFixture;
79 boost::scoped_ptr<const eckit::LocalConfiguration>
test_;
80 boost::scoped_ptr<const Geometry_>
resol_;
81 boost::scoped_ptr<const State_>
xref_;
82 boost::scoped_ptr<const ModelAux_>
bias_;
83 boost::scoped_ptr<const Model_>
model_;
91 const util::Duration
zero(0);
101 const double ininorm = Test_::xref().
norm();
102 State_ xx(Test_::xref());
103 const util::DateTime
vt(xx.validTime());
105 const util::Duration
zero(0);
110 BOOST_CHECK_EQUAL(xx.validTime(),
vt);
111 BOOST_CHECK_EQUAL(xx.norm(), ininorm);
114 BOOST_CHECK_EQUAL(Test_::xref().norm(), ininorm);
123 const double fnorm =
Test_::test().getDouble(
"finalnorm");
127 const double ininorm = Test_::xref().norm();
128 State_ xx(Test_::xref());
129 const util::DateTime
vt(xx.validTime()+
len);
135 BOOST_CHECK_EQUAL(xx.validTime(),
vt);
136 BOOST_CHECK_CLOSE(xx.norm(), fnorm,
tol);
139 BOOST_CHECK_EQUAL(Test_::xref().norm(), ininorm);
152 boost::unit_test::test_suite * ts = BOOST_TEST_SUITE(
"interface/Model");
154 ts->add(BOOST_TEST_CASE(&testModelConstructor<MODEL>));
155 ts->add(BOOST_TEST_CASE(&testModelNoForecast<MODEL>));
156 ts->add(BOOST_TEST_CASE(&testModelForecast<MODEL>));
158 boost::unit_test::framework::master_test_suite().add(ts);
166 #endif // TEST_INTERFACE_MODEL_H_ void register_tests() const
oops::Geometry< MODEL > Geometry_
static const Geometry_ & resol()
static const eckit::Configuration & test()
boost::scoped_ptr< const Geometry_ > resol_
Encapsulates the model state.
static const eckit::Configuration & config()
oops::ModelAuxControl< MODEL > ModelAux_
real(double), parameter zero
boost::scoped_ptr< const Model_ > model_
real, dimension(:,:,:), allocatable vt
oops::Model< MODEL > Model_
boost::scoped_ptr< const eckit::LocalConfiguration > test_
boost::scoped_ptr< const State_ > xref_
Encapsulates the nonlinear forecast model.
static ModelFixture< MODEL > & getInstance()
std::string testid() const
static const Model_ & model()
static const ModelAux_ & bias()
oops::State< MODEL > State_
boost::scoped_ptr< const ModelAux_ > bias_
Control model post processing.
static const State_ & xref()
void testModelConstructor()
void testModelNoForecast()