IODA
test-layoutobsgroup.cpp
Go to the documentation of this file.
1 /*
2  * (C) Crown Copyright 2021 Met Office
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  */
7 
8 
9 #include <string>
10 #include <typeindex>
11 #include "ioda/Exception.h"
12 #include "ioda/testconfig.h"
13 
14 // This header is internal to ioda. It is not callable by end-users outside of the
15 // testing environment.
17 
18 #include "eckit/testing/Test.h"
19 
20 using namespace eckit::testing;
21 
22 namespace ioda {
23 namespace test {
24 
25 CASE("Derived variable and unit conversion methods") {
27  EXPECT_NOT(dataLayoutPolicy.isComplementary("anyVariable"));
28  EXPECT_THROWS(dataLayoutPolicy.getComplementaryPosition("anyVariable"));
29  EXPECT_THROWS(dataLayoutPolicy.getInputsNeeded("anyVariable"));
30  EXPECT_THROWS(dataLayoutPolicy.getMergeMethod("anyVariable"));
31  EXPECT_THROWS(dataLayoutPolicy.getOutputNameFromComponent("anyVariable"));
32  EXPECT_THROWS(dataLayoutPolicy.getOutputVariableDataType("anyVariable"));
33  // unit conversion methods
34  EXPECT_NOT(dataLayoutPolicy.isMapped("anyVariable"));
35  EXPECT_THROWS(dataLayoutPolicy.getUnit("anyVariable"));
36 }
37 
38 } // namespace test
39 } // namespace ioda
40 
41 int main(int argc, char** argv) {
42  return run_tests(argc, argv);
43 }
IODA's error system.
Contains definitions for how data are arranged in ioda internally.
Layout for ObsGroup-like data.
virtual size_t getComplementaryPosition(const std::string &) const
Definition: Layout.cpp:76
virtual std::type_index getOutputVariableDataType(const std::string &) const
Definition: Layout.cpp:84
virtual std::pair< bool, std::string > getUnit(const std::string &) const
Definition: Layout.cpp:96
virtual MergeMethod getMergeMethod(const std::string &) const
Definition: Layout.cpp:88
virtual bool isComplementary(const std::string &) const
Check if the named variable will be a part of a derived variable.
Definition: Layout.cpp:72
virtual bool isMapped(const std::string &) const
Check if the named variable is in the Variables section of the ODB mapping file.
Definition: Layout.cpp:74
virtual std::string getOutputNameFromComponent(const std::string &) const
Definition: Layout.cpp:80
virtual size_t getInputsNeeded(const std::string &) const
Definition: Layout.cpp:92
CASE("Derived variable and unit conversion methods")
int main(int argc, char **argv)