Improved exception handling and unit tests
This commit is contained in:
@@ -5,7 +5,7 @@ classdef OpenCVTest < matlab.unittest.TestCase
|
||||
methods(Test)
|
||||
|
||||
% check if the autogenerated functions can be found
|
||||
function randExists(testcase)
|
||||
function functionsExist(testcase)
|
||||
try
|
||||
cv.rand();
|
||||
catch
|
||||
@@ -13,5 +13,33 @@ classdef OpenCVTest < matlab.unittest.TestCase
|
||||
end
|
||||
testcase.verifyTrue(true);
|
||||
end
|
||||
|
||||
% check that std exception is thrown
|
||||
function stdException(testcase)
|
||||
try
|
||||
std_exception();
|
||||
testcase.verifyFail();
|
||||
catch
|
||||
% TODO: Catch more specific exception
|
||||
testcase.verifyTrue(true);
|
||||
end
|
||||
end
|
||||
|
||||
% check that OpenCV exceptions are correctly caught
|
||||
function cvException(testcase)
|
||||
testcase.verifyFail();
|
||||
end
|
||||
|
||||
% check that all exceptions are caught
|
||||
function allException(testcase)
|
||||
try
|
||||
exception();
|
||||
testcase.verifyFail();
|
||||
catch
|
||||
% TODO: Catch more specific exception
|
||||
testcase.verifyTrue(true);
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@@ -3,3 +3,6 @@ opencv_tests = OpenCVTest();
|
||||
|
||||
%run the tests
|
||||
result = run(opencv_tests);
|
||||
|
||||
% shutdown
|
||||
exit();
|
||||
|
Reference in New Issue
Block a user