8 #ifndef TEST_INTERFACE_OBSOPERATOR_H_ 9 #define TEST_INTERFACE_OBSOPERATOR_H_ 14 #define BOOST_TEST_NO_MAIN 15 #define BOOST_TEST_ALTERNATIVE_INIT_API 16 #define BOOST_TEST_DYN_LINK 17 #include <boost/test/unit_test.hpp> 19 #include <boost/noncopyable.hpp> 20 #include <boost/scoped_ptr.hpp> 22 #include "eckit/config/LocalConfiguration.h" 37 typedef ObsTestsFixture<MODEL> Test_;
40 for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
41 boost::scoped_ptr<ObsOperator_> hop(
new ObsOperator_(Test_::obspace()[jj]));
42 BOOST_CHECK(hop.get());
45 BOOST_CHECK(!hop.get());
60 std::vector<eckit::LocalConfiguration>
conf;
61 obsconf.get(
"ObsTypes",
conf);
63 for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
64 ObsOperator_ hop(Test_::obspace()[jj]);
65 eckit::LocalConfiguration gconf(
conf[jj],
"GeoVaLs");
66 Locations_ locs(Test_::obspace()[jj].locations(Test_::tbgn(), Test_::tend()));
67 const GeoVaLs_ gval(gconf, hop.variables());
69 eckit::LocalConfiguration biasConf;
70 conf[jj].get(
"ObsBias", biasConf);
71 const ObsAuxCtrl_ ybias(biasConf);
73 ObsVector_ ovec(Test_::obspace()[jj]);
75 hop.simulateObs(gval, ovec, ybias);
77 const double zz = ovec.rms();
78 const double xx =
conf[jj].getDouble(
"rmsequiv");
79 const double tol =
conf[jj].getDouble(
"tolerance");
80 BOOST_CHECK_CLOSE(xx, zz,
tol);
94 boost::unit_test::test_suite * ts = BOOST_TEST_SUITE(
"interface/ObsOperator");
96 ts->add(BOOST_TEST_CASE(&testConstructor<MODEL>));
97 ts->add(BOOST_TEST_CASE(&testEquiv<MODEL>));
99 boost::unit_test::framework::master_test_suite().add(ts);
107 #endif // TEST_INTERFACE_OBSOPERATOR_H_
static const eckit::Configuration & config()
void register_tests() const
std::string testid() const