mirror of https://github.com/opencv/opencv.git
parent
31415e344f
commit
bbece095fb
8 changed files with 137 additions and 13 deletions
@ -1,8 +1,5 @@ |
||||
# glob the source files |
||||
file(GLOB SOURCE_FILES *.cpp) |
||||
|
||||
# compile each source |
||||
foreach(SOURCE_FILE_ ${SOURCE_FILES}) |
||||
get_filename_component(SOURCE_FILE_NAME_ ${SOURCE_FILE_} NAME_WE) |
||||
add_custom_target(${SOURCE_FILE_NAME_} ALL ${MATLAB_MEX_SCRIPT} ${SOURCE_FILE_}) |
||||
endforeach() |
||||
# run the matlab test suite |
||||
add_test(opencv_matlab_test |
||||
COMMAND ${MATLAB_BIN} "-nodisplay" "-r" "testsuite.m" |
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
||||
) |
||||
|
@ -0,0 +1,17 @@ |
||||
% Matlab binding test cases |
||||
% Uses Matlab's builtin testing framework |
||||
classdef OpenCVTest < matlab.unittest.TestCase |
||||
|
||||
methods(Test) |
||||
|
||||
% check if the autogenerated functions can be found |
||||
function randExists(testcase) |
||||
try |
||||
cv.rand(); |
||||
catch |
||||
testcase.verifyFail(); |
||||
end |
||||
testcase.verifyTrue(true); |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,33 @@ |
||||
/*
|
||||
* file: exception.cpp |
||||
* author: Hilton Bristow |
||||
* date: Wed, 19 Jun 2013 11:15:15 |
||||
*
|
||||
* See LICENCE for full modification and redistribution details. |
||||
* Copyright 2013 The OpenCV Foundation |
||||
*/ |
||||
#include <exception> |
||||
#include <opencv2/core.hpp> |
||||
#include "mex.h" |
||||
|
||||
/*
|
||||
* exception |
||||
* Gateway routine |
||||
* nlhs - number of return arguments |
||||
* plhs - pointers to return arguments |
||||
* nrhs - number of input arguments |
||||
* prhs - pointers to input arguments |
||||
*/ |
||||
void mexFunction(int nlhs, mxArray* plhs[], |
||||
int nrhs, const mxArray* prhs[]) { |
||||
|
||||
// call the opencv function
|
||||
// [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
|
||||
try { |
||||
throw cv::exception; |
||||
} catch(cv::exception& e) { |
||||
mexErrMsgTxt(e.what()); |
||||
} catch(...) { |
||||
mexErrMsgTxt("Incorrect exception caught!"); |
||||
} |
||||
} |
@ -0,0 +1,29 @@ |
||||
/*
|
||||
* file: exception.cpp |
||||
* author: Hilton Bristow |
||||
* date: Wed, 19 Jun 2013 11:15:15 |
||||
*
|
||||
* See LICENCE for full modification and redistribution details. |
||||
* Copyright 2013 The OpenCV Foundation |
||||
*/ |
||||
#include "mex.h" |
||||
|
||||
/*
|
||||
* exception |
||||
* Gateway routine |
||||
* nlhs - number of return arguments |
||||
* plhs - pointers to return arguments |
||||
* nrhs - number of input arguments |
||||
* prhs - pointers to input arguments |
||||
*/ |
||||
void mexFunction(int nlhs, mxArray* plhs[], |
||||
int nrhs, const mxArray* prhs[]) { |
||||
|
||||
// call the opencv function
|
||||
// [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
|
||||
try { |
||||
throw 1; |
||||
} catch(...) { |
||||
mexErrMsgTxt("Uncaught exception occurred!"); |
||||
} |
||||
} |
@ -0,0 +1,32 @@ |
||||
/*
|
||||
* file: exception.cpp |
||||
* author: Hilton Bristow |
||||
* date: Wed, 19 Jun 2013 11:15:15 |
||||
*
|
||||
* See LICENCE for full modification and redistribution details. |
||||
* Copyright 2013 The OpenCV Foundation |
||||
*/ |
||||
#include <exception> |
||||
#include "mex.h" |
||||
|
||||
/*
|
||||
* exception |
||||
* Gateway routine |
||||
* nlhs - number of return arguments |
||||
* plhs - pointers to return arguments |
||||
* nrhs - number of input arguments |
||||
* prhs - pointers to input arguments |
||||
*/ |
||||
void mexFunction(int nlhs, mxArray* plhs[], |
||||
int nrhs, const mxArray* prhs[]) { |
||||
|
||||
// call the opencv function
|
||||
// [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
|
||||
try { |
||||
throw std::exception(); |
||||
} catch(std::exception& e) { |
||||
mexErrMsgTxt(e.what()); |
||||
} catch(...) { |
||||
mexErrMsgTxt("Incorrect exception caught!"); |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
%setup the tests |
||||
opencv_tests = OpenCVTest(); |
||||
|
||||
%run the tests |
||||
result = run(opencv_tests); |
Loading…
Reference in new issue