Loading [MathJax]/extensions/tex2jax.js
OOPS
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
test/interface/Locations.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_LOCATIONS_H_
12 #define TEST_INTERFACE_LOCATIONS_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/LocalConfiguration.h"
23 #include "eckit/testing/Test.h"
25 #include "oops/mpi/mpi.h"
26 #include "oops/runs/Test.h"
27 #include "test/TestEnvironment.h"
28 
29 namespace test {
30 
31 // -----------------------------------------------------------------------------
32 /// \brief tests test constructor and print method
33 template <typename OBS> void testConstructor() {
34  typedef oops::Locations<OBS> Locations_;
35 
36  const eckit::LocalConfiguration conf(TestEnvironment::config(), "locations");
37  std::unique_ptr<Locations_> locs(new Locations_(conf, oops::mpi::world()));
38  EXPECT(locs.get());
39  oops::Log::test() << "Testing locations: " << *locs << std::endl;
40  locs.reset();
41  EXPECT(!locs.get());
42 }
43 
44 // -----------------------------------------------------------------------------
45 
46 template <typename OBS>
47 class Locations : public oops::Test {
48  public:
49  Locations() {}
50  virtual ~Locations() {}
51  private:
52  std::string testid() const override {return "test::Locations<" + OBS::name() + ">";}
53 
54  void register_tests() const override {
55  std::vector<eckit::testing::Test>& ts = eckit::testing::specification();
56 
57  ts.emplace_back(CASE("interface/Locations/testConstructor")
58  { testConstructor<OBS>(); });
59  }
60 
61  void clear() const override {}
62 };
63 
64 // -----------------------------------------------------------------------------
65 
66 } // namespace test
67 
68 #endif // TEST_INTERFACE_LOCATIONS_H_
Locations of observations for observation operator.
void register_tests() const override
std::string testid() const override
void clear() const override
static const eckit::Configuration & config()
const eckit::mpi::Comm & world()
Default communicator with all MPI tasks (ie MPI_COMM_WORLD)
Definition: oops/mpi/mpi.cc:84
CASE("test_linearmodelparameterswrapper_valid_name")
void testConstructor()
Tests creation and destruction of ObsErrorCovariances.