diff options
author | Cris Luengo <cris.l.luengo@gmail.com> | 2018-10-22 08:19:04 (GMT) |
---|---|---|
committer | Cris Luengo <cris.l.luengo@gmail.com> | 2018-10-24 06:09:06 (GMT) |
commit | 160499296c61b0edf2e6b08c44b31444e022528f (patch) | |
tree | 416376babb083f6b3aeeff3831e4111264be4071 /Tests/FindMatlab/matlab_wrapper2.cpp | |
parent | ee7e97a7d35a793985cf6f9aa185069460cf0ec6 (diff) | |
download | CMake-160499296c61b0edf2e6b08c44b31444e022528f.zip CMake-160499296c61b0edf2e6b08c44b31444e022528f.tar.gz CMake-160499296c61b0edf2e6b08c44b31444e022528f.tar.bz2 |
FindMatlab: added unit tests for new functionality.
Also allowing a way to select which of multiple installed MATLAB versions to use in the test.
Diffstat (limited to 'Tests/FindMatlab/matlab_wrapper2.cpp')
-rw-r--r-- | Tests/FindMatlab/matlab_wrapper2.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/FindMatlab/matlab_wrapper2.cpp b/Tests/FindMatlab/matlab_wrapper2.cpp new file mode 100644 index 0000000..8b73ade --- /dev/null +++ b/Tests/FindMatlab/matlab_wrapper2.cpp @@ -0,0 +1,16 @@ +#include "mex.h" + +// This test uses the new complex-interleaved C API (R2018a and newer) + +// The input should be a complex array (scalar is OK). It returns the number of +// bytes in a matrix element. For the old (R2017b) API, this is 8. For the new +// (R2018a) API, this is 16. + +void mexFunction(const int nlhs, mxArray* plhs[], const int nrhs, + const mxArray* prhs[]) +{ + if (nrhs != 1 || !mxIsComplex(prhs[0])) { + mexErrMsgTxt("Incorrect arguments"); + } + plhs[0] = mxCreateDoubleScalar(mxGetElementSize(prhs[0])); +} |