8 #ifndef TEST_IODA_FILEFORMAT_H_
9 #define TEST_IODA_FILEFORMAT_H_
15 #include "eckit/config/LocalConfiguration.h"
16 #include "eckit/testing/Test.h"
18 #include "oops/mpi/mpi.h"
19 #include "oops/runs/Test.h"
20 #include "oops/test/TestEnvironment.h"
21 #include "oops/util/parameters/Parameters.h"
22 #include "oops/util/parameters/RequiredParameter.h"
24 #include "ioda/core/FileFormat.h"
25 #include "ioda/core/ParameterTraitsFileFormat.h"
33 oops::RequiredParameter<ioda::FileFormat>
format{
"format",
this};
39 oops::RequiredParameter<ioda::FileFormat>
format{
"format",
this};
40 oops::RequiredParameter<ioda::FileFormat>
expectedFormat{
"expected format",
this};
41 oops::RequiredParameter<std::string>
path{
"path",
this};
45 const eckit::Configuration &conf = ::test::TestEnvironment::config();
49 params.validateAndDeserialize(conf.getSubConfiguration(
"auto"));
54 params.validateAndDeserialize(conf.getSubConfiguration(
"hdf5"));
59 params.validateAndDeserialize(conf.getSubConfiguration(
"odb"));
64 EXPECT_THROWS(
params.validateAndDeserialize(conf.getSubConfiguration(
"invalid")));
68 CASE(
"ioda/determineFileFormat") {
69 const eckit::Configuration &conf = ::test::TestEnvironment::config();
70 for (
const eckit::LocalConfiguration &caseConf : conf.getSubConfigurations(
"determine format")) {
72 params.validateAndDeserialize(caseConf);
76 EXPECT(format == expectedFormat);
82 std::string
testid()
const override {
return "test::ioda::FileFormat";}
oops::RequiredParameter< ioda::FileFormat > format
CASE("Derived variable, unit conversion, and exception checking methods")
FileFormat determineFileFormat(const std::string &filePath, FileFormat hint)
Determine the format of an observation file.