libmatio: improve test (#38454)

This commit is contained in:
Joan Massich 2019-04-03 16:47:01 +02:00 committed by FX Coudert
parent 76022cfa24
commit 4050d7cca8

View file

@ -37,11 +37,28 @@ class Libmatio < Formula
(testpath/"mat.c").write <<~'EOS'
#include <stdlib.h>
#include <matio.h>
size_t dims[2] = {5, 5};
double data[25] = {0.0, };
mat_t *mat;
matvar_t *matvar;
int main(int argc, char **argv) {
mat_t *matfp;
if (!(matfp = Mat_Open(argv[1], MAT_ACC_RDONLY)))
if (!(mat = Mat_Open(argv[1], MAT_ACC_RDONLY)))
abort();
Mat_Close(matfp);
Mat_Close(mat);
mat = Mat_CreateVer("test_writenan.mat", NULL, MAT_FT_DEFAULT);
if (mat) {
matvar = Mat_VarCreate("foo", MAT_C_DOUBLE, MAT_T_DOUBLE, 2,
dims, data, MAT_F_DONT_COPY_DATA);
Mat_VarWrite(mat, matvar, MAT_COMPRESSION_NONE);
Mat_VarFree(matvar);
Mat_Close(mat);
} else {
abort();
}
mat = Mat_CreateVer("foo", NULL, MAT_FT_MAT73);
return EXIT_SUCCESS;
}
EOS