MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
ans =

4×1 cell array

{'TestClean/classCheck(Data=commandLineData#ext)' }
{'TestClean/sortCheck(Data=commandLineData#ext)' }
{'TestClean/finiteCheck(Data=commandLineData#ext)'}
{'TestClean/noZeroCheck(Data=commandLineData#ext)'}

Running TestClean
....
Done TestClean
__________

Create another data set that is stored in an ASCII-delimited file.

B = rand(3);
B(2,4) = 0;
dlmwrite('myFile.dat',B)
clear B

Create a parameter with the stored data set and A.

newData = struct('commandLineData',A,'storedData',dlmread('myFile.dat'));
param2 = Parameter.fromData('Data',newData);
suite3 = TestSuite.fromClass(?TestClean,'ExternalParameters',param2);

To run the tests using parameters defined in the test file and externally, concatenate test
suites. View the suite element names and run the tests.

suite = [suite1 suite3];
{suite.Name}'
results = suite.run;

ans =

16×1 cell array

{'TestClean/classCheck(Data=clean)' }
{'TestClean/classCheck(Data=needsCleaning)' }
{'TestClean/sortCheck(Data=clean)' }
{'TestClean/sortCheck(Data=needsCleaning)' }

33 Unit Testing

Free download pdf