I have an m-file
with a couple of tests defined as local functions. They are called from the main function:
function tests = main_function_test()
tests = functiontests(localfunctions);
end
I am doing assertions with some tolerance, so I need to import in each local function:
import matlab.unittest.constraints.IsEqualTo;
import matlab.unittest.constraints.AbsoluteTolerance;
in order to make assertions of the form:
verifyThat(testCase, actual, IsEqualTo(expected, ...
'Within', AbsoluteTolerance(0.00001)));
Is it possible to import those functions just once so they can be reused in each local function?
Aucun commentaire:
Enregistrer un commentaire