Skip to content

Commit

Permalink
Add tests for processing step documentation properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Feb 19, 2024
1 parent 540ba7b commit b1632ea
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 115 deletions.
1 change: 1 addition & 0 deletions resources/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
- Make sure converted values in `mag.process.SignedInteger` are returned as `double`
- Fix [#10](https://github.com/ImperialCollegeLondon/MAG-Data-Visualization-Toolbox/issues/10)
- Fix [#19](https://github.com/ImperialCollegeLondon/MAG-Data-Visualization-Toolbox/issues/19)
- Add tests for processing step documentation properties
79 changes: 0 additions & 79 deletions src/analyze/+mag/+process/Downsample.m

This file was deleted.

2 changes: 1 addition & 1 deletion src/analyze/+mag/+process/Range.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
value = "Apply Range-Based Scaling";
end

function value = get.Description(~)
function value = get.Description(this)
value = "Apply scale factor to " + join(compose("""%s""", this.Variables), ", ") + " based on range """ + this.RangeVariable + """.";
end

Expand Down
2 changes: 1 addition & 1 deletion src/analyze/+mag/+process/SignedInteger.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
value = "Change Signedness";
end

function value = get.Description(~)
function value = get.Description(this)
value = "Convert variables " + join(compose("""%s""", this.Variables), ", ") + " from unsigned to signed int16.";
end

Expand Down
34 changes: 0 additions & 34 deletions tests/unit/analyze/tDownsample.m

This file was deleted.

39 changes: 39 additions & 0 deletions tests/unit/analyze/tStep.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
classdef tStep < MAGAnalysisTestCase
% TSTEP Unit tests for "mag.process.Step" classes.

properties (TestParameter)
StepClass = tStep.retrieveProcessingSteps()
PropertyName = {"Name", "Description", "DetailedDescription"}
end

methods (Test)

% Test that calling documentation properties on processing steps
% does not throw.
function documentationProperty(testCase, StepClass, PropertyName)

% Set up.
stepClass = feval(StepClass);

% Exercise.
documentation = stepClass.(PropertyName);

% Verify.
testCase.assertClass(documentation, "string", "Documentation property type should be ""string"".")
testCase.verifyNotEmpty(documentation, "Documentation property value should not be empty.");
end
end

methods (Static, Access = private)

function classNames = retrieveProcessingSteps()

metaPackage = meta.package.fromName("mag.process");

metaClass = metaPackage.ClassList;
metaClass([metaClass.Abstract]) = [];

classNames = {metaClass.Name};
end
end
end

0 comments on commit b1632ea

Please sign in to comment.