This is my first time writing unit tests, so advice from experienced users will be greatly appreciated.
I have several compute functions from which many of them take in the same input arguments, and I would like to write efficient unit tests with minimum code duplication.
I have a following working test class:
classdef ComputeFunction1Test < matlab.unittest.TestCase
[act, ~] = computeFunction1(input1, input2, input3);
[~, act] = computeFunction1(input1, input2, input3);
I have several more different functions that take the same input arguments and produce output in the same format as computeFunction1.m, which above test class tests. (say computeFunction2.m, computeFunction3.m, and computeFunction3.m, ...)
I could copy the above test class and change the function name to test other functions that take the same input arguments, but this seems inefficient.
Is there a way to handle this situation more efficiently?
Note that I do have other compute functions that require different input arguments as well that need to be tested too. (say specialComputeFunction1 and specialComputeFunction2.m)