FV3 Bundle
test/interface/ObservationSpace.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_OBSERVATIONSPACE_H_
12 #define TEST_INTERFACE_OBSERVATIONSPACE_H_
13 
14 #include <string>
15 
16 #define BOOST_TEST_NO_MAIN
17 #define BOOST_TEST_ALTERNATIVE_INIT_API
18 #define BOOST_TEST_DYN_LINK
19 #include <boost/test/unit_test.hpp>
20 
21 #include <boost/noncopyable.hpp>
22 #include <boost/scoped_ptr.hpp>
23 
24 #include "eckit/config/LocalConfiguration.h"
26 #include "oops/runs/Test.h"
28 #include "test/TestEnvironment.h"
29 
30 namespace test {
31 
32 // -----------------------------------------------------------------------------
33 
34 template <typename MODEL> void testConstructor() {
35  typedef ObsTestsFixture<MODEL> Test_;
36 
37  for (std::size_t jj = 0; jj < Test_::obspace().size(); ++jj) {
38  BOOST_CHECK_EQUAL(Test_::obspace()[jj].windowStart(), Test_::tbgn());
39  BOOST_CHECK_EQUAL(Test_::obspace()[jj].windowEnd(), Test_::tend());
40  }
41 }
42 
43 // -----------------------------------------------------------------------------
44 
45 template <typename MODEL> class ObservationSpace : public oops::Test {
46  public:
48  virtual ~ObservationSpace() {}
49  private:
50  std::string testid() const {return "test::ObservationSpace<" + MODEL::name() + ">";}
51 
52  void register_tests() const {
53  boost::unit_test::test_suite * ts = BOOST_TEST_SUITE("interface/ObservationSpace");
54 
55  ts->add(BOOST_TEST_CASE(&testConstructor<MODEL>));
56 
57  boost::unit_test::framework::master_test_suite().add(ts);
58  }
59 };
60 
61 // -----------------------------------------------------------------------------
62 
63 } // namespace test
64 
65 #endif // TEST_INTERFACE_OBSERVATIONSPACE_H_
character(len=32) name
void testConstructor()