Skip to content

Commit

Permalink
Fixes live script and removes incorrect path from custom file in live…
Browse files Browse the repository at this point in the history
… script
  • Loading branch information
StephenNneji committed Nov 27, 2024
1 parent 9c6841c commit 1235bc3
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 14 deletions.
Binary file modified examples/domains/customLayers/domainsCustomLayersSheet.mlx
Binary file not shown.
Binary file modified examples/domains/customXY/domainsCustomXYSheet.mlx
Binary file not shown.
Binary file modified examples/domains/standardLayers/domainsStandardLayersSheet.mlx
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@
% them in the data block....

% Read in the datafiles
D2O_data = dlmread('c_PLP0016596.dat');
SMW_data = dlmread('c_PLP0016601.dat');
H2O_data = dlmread('c_PLP0016607.dat');
root = getappdata(0, 'root');
D2O_data = dlmread(fullfile(root, '/examples/normalReflectivity/customLayers/c_PLP0016596.dat'));
SMW_data = dlmread(fullfile(root, '/examples/normalReflectivity/customLayers/c_PLP0016601.dat'));
H2O_data = dlmread(fullfile(root, '/examples/normalReflectivity/customLayers/c_PLP0016607.dat'));

% Add the data to the project
problem.addData('Bilayer / D2O', D2O_data(:,1:3));
Expand All @@ -77,7 +78,7 @@
%
% Add the custom file to the project....

problem.addCustomFile('DSPC Model','customBilayer.m','matlab',pwd);
problem.addCustomFile('DSPC Model','customBilayer.m','matlab');
%%
%
%
Expand Down
Binary file modified examples/miscellaneous/convertRascal1Project/convertRascal.mlx
Binary file not shown.
Binary file modified examples/miscellaneous/roundRobin/roundRobin.mlx
Binary file not shown.
Binary file not shown.
Binary file modified examples/normalReflectivity/customXY/customXYDSPCSheet.mlx
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/ORSO/testORSOValidation.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ function testORSO(testCase, layersFile, dataFile)

end

methods (TestClassTeardown)
function clear(~)
close all % Close figure after run
end
end

methods (Static)

function out = orsoTest(layersFile, dataFile)
Expand Down
25 changes: 15 additions & 10 deletions tests/testExamples.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ function testCleanUp(testCase)
end
end


methods(Static)
function setupCurrentDir(testCase, scriptFile)
import matlab.unittest.fixtures.CurrentFolderFixture

[pwdPath, ~, ~] = fileparts(which(scriptFile));
testCase.applyFixture(CurrentFolderFixture(pwdPath))
end
end


methods (Test,ParameterCombination="sequential")
% Runs the different examples sequentially
function testScriptExamples(testCase, ...
Expand All @@ -93,11 +104,7 @@ function testScriptExamples(testCase, ...

% verifies example exists with .m extension
testCase.verifyEqual(exist(exampleScriptFile,'file'), 2);
import matlab.unittest.fixtures.CurrentFolderFixture

[pwdPath, ~, ~] = fileparts(which(exampleScriptFile));
testCase.applyFixture(CurrentFolderFixture(pwdPath))

testExamples.setupCurrentDir(testCase, exampleScriptFile)
% runs the example file
evalc(exampleScriptFile);

Expand Down Expand Up @@ -126,8 +133,9 @@ function testScriptExamples(testCase, ...
close all;
end

function testLiveScriptExamples(~, exampleLiveScriptFile)
function testLiveScriptExamples(testCase, exampleLiveScriptFile)
% runs the example live script file
testExamples.setupCurrentDir(testCase, exampleLiveScriptFile)
evalc(exampleLiveScriptFile);
close all;
end
Expand All @@ -137,10 +145,7 @@ function testWriteScript(testCase, exampleScriptFile)
% to a script that can regenerate the object
% verifies example exists with .m extension
testCase.verifyEqual(exist(exampleScriptFile,'file'), 2);
import matlab.unittest.fixtures.CurrentFolderFixture

[pwdPath, ~, ~] = fileparts(which(exampleScriptFile));
testCase.applyFixture(CurrentFolderFixture(pwdPath))
testExamples.setupCurrentDir(testCase, exampleScriptFile)

% runs the example file
evalc(exampleScriptFile);
Expand Down

0 comments on commit 1235bc3

Please sign in to comment.