From feae80e5e4236654ea5a843197e05d9211869750 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 8 Nov 2023 14:07:58 +0100 Subject: codec-netcdf: Basic netcdf implementation --- tests/.nix/derivation.nix | 1 + tests/codec-netcdf.cpp | 25 +++++++++++++++++++++++++ tests/data/simple.nc | Bin 0 -> 68 bytes 3 files changed, 26 insertions(+) create mode 100644 tests/codec-netcdf.cpp create mode 100644 tests/data/simple.nc (limited to 'tests') diff --git a/tests/.nix/derivation.nix b/tests/.nix/derivation.nix index 198095e..e096e70 100644 --- a/tests/.nix/derivation.nix +++ b/tests/.nix/derivation.nix @@ -19,6 +19,7 @@ stdenv.mkDerivation { forstio.async forstio.codec forstio.codec-json + forstio.codec-netcdf forstio.core forstio.io forstio.test 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 +#include + +namespace { +namespace schema { +using namespace saw::schema; +using TestStruct = Struct< + Member +>; +} + +SAW_TEST("NetCDF read"){ + using namespace saw; + + data net{"./data/simple.nc"}; + + data kel; + + codec codec; + + auto eov = codec.decode(net, kel); + SAW_EXPECT(eov.is_value(), "Decoding failed"); + SAW_EXPECT(kel.get<"rh">.get() == 5, "Value incorrect"); +} +} diff --git a/tests/data/simple.nc b/tests/data/simple.nc new file mode 100644 index 0000000..4fc2473 Binary files /dev/null and b/tests/data/simple.nc differ -- cgit v1.2.3