Files
imdd_silas/Tests/createTestFile.m
2026-03-24 17:23:02 +01:00

24 lines
1.0 KiB
Matlab

function createTestFile(testClassName, targetClassName, targetClassFile, testFilePath)
%CREATETESTFILE Create a placeholder test file for an unimplemented class.
testClassName = char(testClassName);
targetClassName = char(targetClassName);
targetClassFile = char(targetClassFile);
testFilePath = char(testFilePath);
fid = fopen(testFilePath, "w");
assert(fid ~= -1, "Could not create test file: %s", testFilePath);
cleaner = onCleanup(@() fclose(fid));
fprintf(fid, "classdef %s < IMDDTestCase\n", testClassName);
fprintf(fid, " %% Auto-generated placeholder for %s.\n", targetClassName);
fprintf(fid, " %% Target: %s\n\n", strrep(targetClassFile, '\', '/'));
fprintf(fid, " methods (Test, TestTags = {'placeholder', 'todo'})\n");
fprintf(fid, " function testNotImplemented(testCase)\n");
fprintf(fid, " testCase.assumeFail(""Tests for %s are not implemented yet."");\n", targetClassName);
fprintf(fid, " end\n");
fprintf(fid, " end\n");
fprintf(fid, "end\n");
end