summaryrefslogtreecommitdiff
path: root/tests/codec-netcdf.cpp
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2023-11-08 14:07:58 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2023-11-08 14:08:19 +0100
commitfeae80e5e4236654ea5a843197e05d9211869750 (patch)
tree38a69e7c498f34a857f594df6bbe5082f863f68b /tests/codec-netcdf.cpp
parentfd29f23d000db081da1976659e72a679b4ebb9c4 (diff)
codec-netcdf: Basic netcdf implementation
Diffstat (limited to 'tests/codec-netcdf.cpp')
-rw-r--r--tests/codec-netcdf.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/codec-netcdf.cpp b/tests/codec-netcdf.cpp
new file mode 100644
index 0000000..df0037b
--- /dev/null
+++ b/tests/codec-netcdf.cpp
@@ -0,0 +1,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");
+}
+}