FV3 Bundle
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 <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/Configuration.h"
26 #include "oops/runs/Test.h"
27 #include "test/TestEnvironment.h"
28 
29 namespace test {
30 
31 // -----------------------------------------------------------------------------
32 template <typename MODEL> class ObsAuxCovarianceFixture : private boost::noncopyable {
33  public:
34  static const eckit::Configuration & config() {return *getInstance().conf_;}
35 
36  private:
38  static ObsAuxCovarianceFixture<MODEL> theObsAuxCovarianceFixture;
39  return theObsAuxCovarianceFixture;
40  }
41 
43  conf_.reset(new eckit::LocalConfiguration(TestEnvironment::config(), "ObsBiasCovariance"));
44  }
45 
47 
48  boost::scoped_ptr<const eckit::LocalConfiguration> conf_;
49 };
50 
51 // -----------------------------------------------------------------------------
52 
53 template <typename MODEL> void testConstructor() {
54  typedef ObsAuxCovarianceFixture<MODEL> Test_;
55  typedef oops::ObsAuxCovariance<MODEL> Covariance_;
56 
57  boost::scoped_ptr<Covariance_> bias(new Covariance_(Test_::config()));
58  BOOST_CHECK(bias.get());
59 
60  bias.reset();
61  BOOST_CHECK(!bias.get());
62 }
63 
64 // -----------------------------------------------------------------------------
65 // void linearize(const ObsAuxControl_ &, const Geometry_ &);
66 // void multiply(const ObsAuxIncrement_ &, ObsAuxIncrement_ &) const;
67 // void invMult(const ObsAuxIncrement_ &, ObsAuxIncrement_ &) const;
68 // void randomize(ObsAuxIncrement_ &) const;
69 // -----------------------------------------------------------------------------
70 
71 // -----------------------------------------------------------------------------
72 
73 template <typename MODEL> class ObsAuxCovariance : public oops::Test {
74  public:
76  virtual ~ObsAuxCovariance() {}
77  private:
78  std::string testid() const {return "test::ObsAuxCovariance<" + MODEL::name() + ">";}
79 
80  void register_tests() const {
81  boost::unit_test::test_suite * ts = BOOST_TEST_SUITE("interface/ObsAuxCovariance");
82 
83  ts->add(BOOST_TEST_CASE(&testConstructor<MODEL>));
84 
85  boost::unit_test::framework::master_test_suite().add(ts);
86  }
87 };
88 
89 // =============================================================================
90 
91 } // namespace test
92 
93 #endif // TEST_INTERFACE_OBSAUXCOVARIANCE_H_
static ObsAuxCovarianceFixture< MODEL > & getInstance()
static const eckit::Configuration & config()
character(len=32) name
static const eckit::Configuration & config()
void testConstructor()
boost::scoped_ptr< const eckit::LocalConfiguration > conf_