Skip to content

Commit

Permalink
Moved test setup from script to individual class
Browse files Browse the repository at this point in the history
  • Loading branch information
ssun30 committed Jun 9, 2023
1 parent f72ea57 commit e4af429
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
cc_flags=-D_GLIBCXX_ASSERTIONS
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Run test script
uses: matlab-actions/run-command@v1
with:
command: cd ~/work/cantera/cantera; addpath([pwd, '/test/matlab_experimental']); ctRunTests;
# - name: Run test script
# uses: matlab-actions/run-command@v1
# with:
# command: cd ~/work/cantera/cantera; addpath([pwd, '/test/matlab_experimental']); ctRunTests;
- name: Run tests directly
uses: matlab-actions/run-tests@v1
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,3 @@
end

disp('Cantera is loaded for test');

% Run all tests
results1 = runtests('ctTestThermo')

% Unload Cantera and remove temporary library file
unloadlibrary('libcantera_shared');
delete([rootDir, ctName]);

disp('Cantera has been unloaded');
10 changes: 10 additions & 0 deletions test/matlab_experimental/ctTestTearDown.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
clear all

rootDir = fullfile(pwd);
ctName = '/test/matlab_experimental/libcantera_shared.so';

% Unload Cantera and remove temporary library file
unloadlibrary('libcantera_shared');
delete([rootDir, ctName]);

disp('Cantera has been unloaded');
13 changes: 10 additions & 3 deletions test/matlab_experimental/ctTestThermo.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@
atol = 1e-8;
end

methods (TestClassSetup)
function testSetUp(self)
ctTestSetUp
end
end

methods (TestClassTeardown)
function testTearDown(self)
% Clean up Cantera
ctCleanUp
ctTestTearDown
end
end

methods (TestMethodSetup)
% Setup for each test

function createPhase(self)
src = 'h2o2.yaml';
id = 'ohmech';
Expand All @@ -25,7 +32,7 @@ function createPhase(self)
end

methods (TestMethodTeardown)
% Destroy object

function deleteSolution(self)
clear self.phase;
end
Expand Down Expand Up @@ -453,4 +460,4 @@ function testInvalidProperty(self)

end

end
end

0 comments on commit e4af429

Please sign in to comment.