-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add controls test * updating workflow to run Controls tests on CI * minor update to wecSimAppTest --------- Co-authored-by: kmruehl <[email protected]>
- Loading branch information
Showing
5 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
classdef TestControls < matlab.unittest.TestCase | ||
|
||
properties | ||
OriginalDefault | ||
testDir | ||
h5Dir = "hydroData" | ||
h5Name = 'sphere.h5' | ||
outName = 'sphere.out' | ||
end | ||
|
||
methods (Access = 'public') | ||
function obj = TestControls | ||
obj.testDir = fileparts(mfilename('fullpath')); | ||
end | ||
end | ||
|
||
methods (TestMethodSetup) | ||
function killPlots (~) | ||
set(0,'DefaultFigureVisible','off'); | ||
end | ||
end | ||
|
||
methods(TestClassSetup) | ||
function captureVisibility(testCase) | ||
testCase.OriginalDefault = get(0,'DefaultFigureVisible'); | ||
end | ||
function runBemio(testCase) | ||
cd(testCase.h5Dir); | ||
if isfile(testCase.h5Name) | ||
fprintf('runBemio skipped, *.h5 already exists\n') | ||
else | ||
bemio | ||
end | ||
cd(testCase.testDir) | ||
end | ||
end | ||
|
||
methods(TestMethodTeardown) | ||
function returnHome(testCase) | ||
cd(testCase.testDir) | ||
end | ||
end | ||
|
||
methods(TestClassTeardown) | ||
function checkVisibilityRestored(testCase) | ||
set(0,'DefaultFigureVisible',testCase.OriginalDefault); | ||
testCase.assertEqual(get(0,'DefaultFigureVisible'), ... | ||
testCase.OriginalDefault); | ||
end | ||
end | ||
|
||
methods(Test) | ||
function testPassive(testCase) | ||
cd('Passive (P)') | ||
wecSim | ||
end | ||
function testReactive(testCase) | ||
cd('Reactive (PI)') | ||
wecSim | ||
end | ||
function testLatching(testCase) | ||
cd('Latching') | ||
wecSim | ||
end | ||
function testDeclutching(testCase) | ||
cd('Declutching') | ||
wecSim | ||
end | ||
function testMPC(testCase) | ||
cd('MPC') | ||
wecSim | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters