OOPS
test/interface/ObsSpace.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  * (C) Copyright 2017-2019 UCAR.
4  *
5  * This software is licensed under the terms of the Apache Licence Version 2.0
6  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
7  * In applying this licence, ECMWF does not waive the privileges and immunities
8  * granted to it by virtue of its status as an intergovernmental organisation nor
9  * does it submit to any jurisdiction.
10  */
11 
12 #ifndef TEST_INTERFACE_OBSSPACE_H_
13 #define TEST_INTERFACE_OBSSPACE_H_
14 
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/LocalConfiguration.h"
23 #include "eckit/testing/Test.h"
25 #include "oops/runs/Test.h"
27 #include "test/TestEnvironment.h"
28 
29 namespace test {
30 
31 // -----------------------------------------------------------------------------
32 
33 template <typename OBS> void testConstructor() {
34  typedef ObsTestsFixture<OBS> Test_;
35 
36  for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
37  EXPECT(Test_::obspace()[jj].windowStart() == Test_::tbgn());
38  EXPECT(Test_::obspace()[jj].windowEnd() == Test_::tend());
39  }
40 }
41 
42 // -----------------------------------------------------------------------------
43 
44 template <typename OBS> class ObsSpace : public oops::Test {
46  public:
47  ObsSpace() {}
48  virtual ~ObsSpace() {}
49  private:
50  std::string testid() const override {return "test::ObsSpace<" + OBS::name() + ">";}
51 
52  void register_tests() const override {
53  std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
54 
55  ts.emplace_back(CASE("interface/ObsSpace/testConstructor")
56  { testConstructor<OBS>(); });
57  }
58 
59  void clear() const override {
60  Test_::reset();
61  }
62 };
63 
64 // -----------------------------------------------------------------------------
65 
66 } // namespace test
67 
68 #endif // TEST_INTERFACE_OBSSPACE_H_
test::ObsTestsFixture
Definition: ObsTestsFixture.h:29
test::ObsTestsFixture::reset
static void reset()
Definition: ObsTestsFixture.h:37
test::ObsSpace::clear
void clear() const override
Definition: test/interface/ObsSpace.h:59
test::ObsSpace::Test_
ObsTestsFixture< OBS > Test_
Definition: test/interface/ObsSpace.h:45
test::CASE
CASE("test_linearmodelparameterswrapper_valid_name")
Definition: LinearModelFactory.cc:22
test::ObsSpace::testid
std::string testid() const override
Definition: test/interface/ObsSpace.h:50
test::ObsSpace::~ObsSpace
virtual ~ObsSpace()
Definition: test/interface/ObsSpace.h:48
test
Definition: LinearModelFactory.cc:20
test::ObsSpace::register_tests
void register_tests() const override
Definition: test/interface/ObsSpace.h:52
test::ObsSpace
Definition: test/interface/ObsSpace.h:44
Test.h
ObsTestsFixture.h
ObsSpace.h
TestEnvironment.h
test::testConstructor
void testConstructor()
Tests creation and destruction of ObsErrorCovariances.
Definition: test/base/ObsErrorCovariance.h:32
test::ObsSpace::ObsSpace
ObsSpace()
Definition: test/interface/ObsSpace.h:47
oops::Test
Definition: Test.h:39