23 lines
814 B
Matlab
23 lines
814 B
Matlab
function createTestFile(className, testFilePath)
|
|
% Open the file for writing
|
|
fid = fopen(testFilePath, 'w');
|
|
|
|
% Write the basic structure for the test class
|
|
fprintf(fid, 'classdef %s_test < matlab.unittest.TestCase\n', className);
|
|
fprintf(fid, ' %% Test class for %s\n\n', className);
|
|
|
|
fprintf(fid, ' methods (Test)\n');
|
|
fprintf(fid, ' function testExample(testCase)\n');
|
|
fprintf(fid, ' %% Example test case for %s\n', className);
|
|
fprintf(fid, ' %% Add your test code here\n');
|
|
fprintf(fid, ' testCase.verifyTrue(true);\n');
|
|
fprintf(fid, ' end\n');
|
|
fprintf(fid, ' end\n');
|
|
|
|
fprintf(fid, 'end\n');
|
|
|
|
% Close the file
|
|
fclose(fid);
|
|
|
|
fprintf('Created test file: %s\n', testFilePath);
|
|
end |