Commit e06fff8b authored by Antoine Merle's avatar Antoine Merle
Browse files

Add dummy MEX-file and test suite files

parent ef84206f
Pipeline #113318 passed with stages
in 22 seconds
*.mexa64
# Includes a common template
include:
- project: 'spc/tcv/tbx/git-tools-spc'
file: 'gitlab-ci-tbx-template.yml'
variables:
MATVER: 906
MATFIRST: 804
# Build
build:
extends: .build-template
script:
- echo "Script to build (e.g. mexes)"
- echo make
- make
artifacts:
paths:
- ./*.mexa64
expire_in: 1 week
# Tests
test-matlab-8.5.0:
extends: .test-template
variables:
MATLABCMD: matlab850
TESTCASE: basic
test-matlab-9.0.0:
extends: .test-template
variables:
MATLABCMD: matlab900
TESTCASE: basic
test-matlab-9.2.0:
extends: .test-template
variables:
MATLABCMD: matlab920
TESTCASE: basic
test-matlab-9.6.0:
extends: .test-template
variables:
MATLABCMD: matlab960
TESTCASE: basic
# Post test report collection
code-coverage-960:
extends: .code-coverage-960-template
# Pre-deployment checks
pre-deployment-checks:
extends: .pre-deployment-checks-template
# Staging
pre-deployment-staging:
extends: .staging-template
test-staging-8.5.0:
extends: .test-staging-template
variables:
MATLABCMD: matlab850
TESTCASE: basic
test-staging-9.0.0:
extends: .test-staging-template
variables:
MATLABCMD: matlab900
TESTCASE: basic
test-staging-9.2.0:
extends: .test-staging-template
variables:
MATLABCMD: matlab920
TESTCASE: basic
test-staging-9.6.0:
extends: .test-staging-template
variables:
MATLABCMD: matlab960
TESTCASE: basic
# HTML code coverage report
html-coverage-report-960:
extends: .html-coverage-report-960
# Deployment
deployment:
extends: .deploy-to-lac-template
test-post-deploy-matlab:
extends: .test-post-deploy-template
# Test deployed version
daily-tests-deployed:
extends: .test-deployed-template
# Set up MATLAB-related path
ifeq ($(MAKECMDGOALS),$(filter-out clean,$(MAKECMDGOALS)))
ifeq (undefined,$(origin MATPATH))
ifneq (,$(MATLAB))
# If MATPATH is not explicitly defined and MATLAB is defined
# then assign value of MATLAB to MATPATH
MATPATH=$(MATLAB)
endif
endif
MATPATH ?=/usr/local/MATLAB/R2019a
MATCMD =$(MATPATH)/bin/matlab -nodisplay
MEXCMD =$(MATPATH)/bin/mex
ifeq (,$(wildcard $(MEXCMD)))
$(error Cannot find mex executable at location: $(MEXCMD))
endif
MEXEXT :=$(shell $(MATPATH)/bin/mexext)
endif
nansmex.$(MEXEXT): mexc/nansmex.c
$(MEXCMD) $^ -Iinclude
clean:
$(RM) -rf nansmex.mex*
# include <math.h>
# include <ieee754.h>
# include "mex.h"
# include "mexargs.h"
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
# define MEXNAME nansmex
/* out = nansmex(in); */
# define OUT pout[0]
# define IN prhs[0] /* double, optional */
CHECK_NARGIN_LE(1);
if (nrhs>0) CHECK_DOUBLE(IN);
CHECK_NARGOUT_LE(1);
mxArray *pout[1];
int k;
double *pr;
union ieee754_double u;
bool *pl;
if (nrhs == 0) {
OUT = mxCreateDoubleMatrix(1, 1, mxREAL);
mxGetPr(OUT)[0] = __builtin_nans("") /* DBL_SNAN */ ;
} else {
OUT = mxCreateLogicalArray(mxGetNumberOfDimensions(prhs[0]),mxGetDimensions(prhs[0]));
pl = mxGetLogicals(OUT);
pr = mxGetPr(IN);
for (k = mxGetNumberOfElements(IN); k--; ) {
/* pl[k] = fpclassify(pr[k]) == FP_SNAN; */
u.d = pr[k];
pl[k] = (double)( fpclassify(pr[k]) == FP_NAN && u.ieee_nan.quiet_nan == 0);
}
}
ASSIGN_PLHS;
}
/*
format hex
x = [NaN nans];
disp(x)
format short
disp(x)
disp(isnan(x))
disp(isnans(x))
*/
/home/matlab/crpptbx/testtbx/run_tbx_tests.m
\ No newline at end of file
/home/matlab/crpptbx/testtbx/test_script.sh
\ No newline at end of file
classdef tbx_mexargs_test < mexargs_test
% TBX_MEXARGS_TEST test class for C MEX-files argument checks
%
% Inherits from the mexargs_test abstract class, redefines the mexfile property
% with all MEX-file names and each corresponding function defining the checks
properties (ClassSetupParameter)
mexfile = {
'nansmex',...
};
end
methods (Static)
function S = nansmex_args
S = mexargs('nansmex',{'le',1},{'le',1});
S.addarg(1,{'type','double'});
end
end
end
/home/matlab/crpptbx/testtbx/tests_matlab.m
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment