diff options
Diffstat (limited to 'test cases/frameworks/26 netcdf')
-rw-r--r-- | test cases/frameworks/26 netcdf/main.c | 14 | ||||
-rw-r--r-- | test cases/frameworks/26 netcdf/main.cpp | 15 | ||||
-rw-r--r-- | test cases/frameworks/26 netcdf/main.f90 | 19 | ||||
-rw-r--r-- | test cases/frameworks/26 netcdf/meson.build | 36 | ||||
-rw-r--r-- | test cases/frameworks/26 netcdf/test.json | 3 |
5 files changed, 87 insertions, 0 deletions
diff --git a/test cases/frameworks/26 netcdf/main.c b/test cases/frameworks/26 netcdf/main.c new file mode 100644 index 0000000..e592585 --- /dev/null +++ b/test cases/frameworks/26 netcdf/main.c @@ -0,0 +1,14 @@ +#include "netcdf.h" + +int main(void) +{ +int ret, ncid; + +if ((ret = nc_create("foo.nc", NC_CLOBBER, &ncid))) + return ret; + +if ((ret = nc_close(ncid))) + return ret; + +return 0; +} diff --git a/test cases/frameworks/26 netcdf/main.cpp b/test cases/frameworks/26 netcdf/main.cpp new file mode 100644 index 0000000..a3c98ef --- /dev/null +++ b/test cases/frameworks/26 netcdf/main.cpp @@ -0,0 +1,15 @@ +#include <iostream> +#include "netcdf.h" + +int main(void) +{ +int ret, ncid; + +if ((ret = nc_create("foo.nc", NC_CLOBBER, &ncid))) + return ret; + +if ((ret = nc_close(ncid))) + return ret; + +return EXIT_SUCCESS; +} diff --git a/test cases/frameworks/26 netcdf/main.f90 b/test cases/frameworks/26 netcdf/main.f90 new file mode 100644 index 0000000..3872298 --- /dev/null +++ b/test cases/frameworks/26 netcdf/main.f90 @@ -0,0 +1,19 @@ +use netcdf + +implicit none + +integer :: ncid + +call check( nf90_create("foo.nc", NF90_CLOBBER, ncid) ) + +call check( nf90_close(ncid) ) + +contains + + subroutine check(status) + integer, intent (in) :: status + + if(status /= nf90_noerr) error stop trim(nf90_strerror(status)) +end subroutine check + +end program diff --git a/test cases/frameworks/26 netcdf/meson.build b/test cases/frameworks/26 netcdf/meson.build new file mode 100644 index 0000000..0adc5e9 --- /dev/null +++ b/test cases/frameworks/26 netcdf/meson.build @@ -0,0 +1,36 @@ +project('netcdf_test', 'c') + +cc = meson.get_compiler('c') +c_code = '''#include <netcdf.h> +int main(void) { return 0; }''' +# --- C +nc_c = dependency('netcdf', language : 'c', required : false, disabler: true) +if not cc.links(c_code, dependencies: nc_c, name: 'NetCDF C') + nc_c = disabler() +endif +if not nc_c.found() + error('MESON_SKIP_TEST: NetCDF C library not found, skipping NetCDF framework tests.') +endif +exec = executable('exec', 'main.c', dependencies : nc_c) +test('NetCDF C', exec, timeout: 15) + +# --- C++ +if add_languages('cpp', required: false) + nc_cpp = dependency('netcdf', language : 'cpp', required : false, disabler: true) + execpp = executable('execpp', 'main.cpp', dependencies : nc_cpp) + test('NetCDF C++', execpp, timeout: 15) +endif + +# --- Fortran +if build_machine.system() != 'windows' and build_machine.system() != 'darwin' + if add_languages('fortran', required: false) + nc_f = dependency('netcdf', language : 'fortran', required : false, disabler: true) + exef = executable('exef', 'main.f90', dependencies : nc_f) + test('NetCDF Fortran', exef, timeout: 15) + endif +endif + +# Check we can apply a version constraint +if nc_c.version() != 'unknown' + dependency('netcdf', version: '>=@0@'.format(nc_c.version())) +endif diff --git a/test cases/frameworks/26 netcdf/test.json b/test cases/frameworks/26 netcdf/test.json new file mode 100644 index 0000000..83c6291 --- /dev/null +++ b/test cases/frameworks/26 netcdf/test.json @@ -0,0 +1,3 @@ +{ + "skip_on_jobname": ["azure", "bionic", "cygwin", "fedora", "macos", "msys2", "opensuse", "ubuntu"] +} |