summaryrefslogtreecommitdiff
path: root/tests/codec-netcdf.cpp
blob: df0037bc1666580b7e28d6cc54fb924e6cb4e3f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <forstio/test/suite.h>
#include <forstio/codec/netcdf/netcdf.h>

namespace {
namespace schema {
using namespace saw::schema;
using TestStruct = Struct<
		Member<Int32, "rh">
>;
}

SAW_TEST("NetCDF read"){
		using namespace saw;
		
		data<TestStruct, encode::Netcdf> net{"./data/simple.nc"};

		data<TestStruct, encode::KelSimple> kel;

		codec<TestStruct, encode::Netcdf> codec;

		auto eov = codec.decode(net, kel);
		SAW_EXPECT(eov.is_value(), "Decoding failed");
		SAW_EXPECT(kel.get<"rh">.get() == 5, "Value incorrect");
}
}