OOPS
test/interface/ObsAuxCovariance.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #ifndef TEST_INTERFACE_OBSAUXCOVARIANCE_H_
12 #define TEST_INTERFACE_OBSAUXCOVARIANCE_H_
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #define ECKIT_TESTING_SELF_REGISTER_CASES 0
19 
20 #include <boost/noncopyable.hpp>
21 
22 #include "eckit/config/Configuration.h"
24 #include "oops/runs/Test.h"
26 #include "test/TestEnvironment.h"
27 
28 namespace test {
29 
30 // -----------------------------------------------------------------------------
31 
32 template <typename OBS> void testConstructor() {
33  typedef ObsTestsFixture<OBS> Test_;
34  typedef oops::ObsAuxCovariance<OBS> Covariance_;
35 
36  std::vector<eckit::LocalConfiguration> oconf;
37  TestEnvironment::config().get("observations", oconf);
38  for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
39  std::unique_ptr<Covariance_> bias(new Covariance_(Test_::obspace()[jj], oconf[jj]));
40  EXPECT(bias.get());
41 
42  bias.reset();
43  EXPECT(!bias.get());
44  }
45 }
46 
47 // -----------------------------------------------------------------------------
48 // void linearize(const ObsAuxControl_ &, const Geometry_ &);
49 // void multiply(const ObsAuxIncrement_ &, ObsAuxIncrement_ &) const;
50 // void invMult(const ObsAuxIncrement_ &, ObsAuxIncrement_ &) const;
51 // void randomize(ObsAuxIncrement_ &) const;
52 // -----------------------------------------------------------------------------
53 
54 // -----------------------------------------------------------------------------
55 
56 template <typename OBS>
57 class ObsAuxCovariance : public oops::Test {
59  public:
61  virtual ~ObsAuxCovariance() {}
62  private:
63  std::string testid() const override {return "test::ObsAuxCovariance<" + OBS::name() + ">";}
64 
65  void register_tests() const override {
66  std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
67 
68  ts.emplace_back(CASE("interface/ObsAuxCovariance/testConstructor")
69  { testConstructor<OBS>(); });
70  }
71 
72  void clear() const override {
73  Test_::reset();
74  }
75 };
76 
77 // =============================================================================
78 
79 } // namespace test
80 
81 #endif // TEST_INTERFACE_OBSAUXCOVARIANCE_H_
test::ObsTestsFixture
Definition: ObsTestsFixture.h:29
ObsAuxCovariance.h
test::ObsAuxCovariance::testid
std::string testid() const override
Definition: test/interface/ObsAuxCovariance.h:63
test::ObsTestsFixture::reset
static void reset()
Definition: ObsTestsFixture.h:37
test::ObsAuxCovariance::register_tests
void register_tests() const override
Definition: test/interface/ObsAuxCovariance.h:65
test::CASE
CASE("test_linearmodelparameterswrapper_valid_name")
Definition: LinearModelFactory.cc:22
test::ObsAuxCovariance
Definition: test/interface/ObsAuxCovariance.h:57
test
Definition: LinearModelFactory.cc:20
test::ObsAuxCovariance::clear
void clear() const override
Definition: test/interface/ObsAuxCovariance.h:72
oops::ObsAuxCovariance
Definition: oops/interface/ObsAuxCovariance.h:36
Test.h
test::TestEnvironment::config
static const eckit::Configuration & config()
Definition: TestEnvironment.h:40
ObsTestsFixture.h
test::ObsAuxCovariance::ObsAuxCovariance
ObsAuxCovariance()
Definition: test/interface/ObsAuxCovariance.h:60
test::ObsAuxCovariance::~ObsAuxCovariance
virtual ~ObsAuxCovariance()
Definition: test/interface/ObsAuxCovariance.h:61
test::ObsAuxCovariance::Test_
ObsTestsFixture< OBS > Test_
Definition: test/interface/ObsAuxCovariance.h:58
TestEnvironment.h
test::testConstructor
void testConstructor()
Tests creation and destruction of ObsErrorCovariances.
Definition: test/base/ObsErrorCovariance.h:32
oops::Test
Definition: Test.h:39