Skip to content

Commit 0f5f1ec

Browse files
committed
Added automated testing / code coverage testing
1 parent e08fc0d commit 0f5f1ec

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

buildfile.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function plan = buildfile
2+
import matlab.buildtool.tasks.*
3+
4+
plan = buildplan(localfunctions);
5+
6+
plan("clean") = CleanTask;
7+
plan("check") = CodeIssuesTask(Results="issues.mat");
8+
plan("test") = TestTask("test_examples_dev.m",SourceFiles=["gramm/@gramm/*.m" "gramm/@gramm/private/*.m"], ...
9+
TestResults = "testresults.html").addCodeCoverage("coverageresults.html");
10+
11+
plan.DefaultTasks = ["check" "test"];
12+
end
13+

test_examples_dev.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
classdef test_examples_dev < matlab.unittest.TestCase
2+
% Test class that runs examples_dev.m for code coverage
3+
4+
methods(Test)
5+
function testExamples(testCase)
6+
% Run the examples script
7+
% This will execute all the gramm examples and generate coverage
8+
run('examples_dev.m');
9+
10+
% If we get here without error, the test passes
11+
testCase.verifyTrue(true, 'examples_dev.m completed successfully');
12+
end
13+
end
14+
end

0 commit comments

Comments
 (0)