8 #ifndef TEST_BASE_DEPARTURES_H_
9 #define TEST_BASE_DEPARTURES_H_
11 #include <Eigen/Dense>
15 #define ECKIT_TESTING_SELF_REGISTER_CASES 0
17 #include "eckit/config/LocalConfiguration.h"
18 #include "eckit/testing/Test.h"
21 #include "oops/util/Logger.h"
33 Departures_ y(Test_::obspace());
34 Departures_ y2(Test_::obspace());
35 Departures_ ydiff(Test_::obspace());
39 double ref_rms = y.rms();
40 oops::Log::test() <<
"yrandom.rms=" << ref_rms << std::endl;
43 oops::Log::test() <<
"yzero.rms=" << y2.rms() << std::endl;
47 oops::Log::test() <<
"rms(yrandom-yzero)=" << ydiff.rms() << std::endl;
49 EXPECT(ydiff.rms() != 0.0);
52 Eigen::VectorXd ypack = y.packEigen();
53 oops::Log::info() <<
"ypack: " << ypack << std::endl;
54 double rms = ypack.norm() / sqrt(ypack.size());
55 oops::Log::test() <<
"rms(ypack)=" << rms << std::endl;
56 oops::Log::test() <<
"y.rms()=" << ref_rms << std::endl;
57 oops::Log::test() <<
"y.rms()-rms(ypack)" << ref_rms - rms << std::endl;
59 EXPECT(oops::is_close(ref_rms, rms, 1.e-14));
68 std::string
testid()
const override {
return "test::Departures<" + OBS::name() +
">";}
71 std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
72 ts.emplace_back(
CASE(
"base/Departures/testDepartures")
73 { testDepartures<OBS>(); });
85 #endif // TEST_BASE_DEPARTURES_H_