mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[MATLAB] Added tests for duplicate reactions
This commit is contained in:
parent
4c79dad043
commit
98f87517db
101
test/matlab_experimental/ctTestDuplicateReactions.m
Normal file
101
test/matlab_experimental/ctTestDuplicateReactions.m
Normal file
@ -0,0 +1,101 @@
|
||||
classdef ctTestDuplicateReactions < matlab.unittest.TestCase
|
||||
|
||||
properties
|
||||
phase
|
||||
end
|
||||
|
||||
methods (TestClassSetup)
|
||||
|
||||
function testSetUp(self)
|
||||
ctTestSetUp
|
||||
copyfile('../data/duplicate-reactions.yaml', ...
|
||||
'./duplicate-reactions.yaml');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods (TestClassTeardown)
|
||||
|
||||
function testTearDown(self)
|
||||
delete('./duplicate-reactions.yaml');
|
||||
ctCleanUp
|
||||
ctTestTearDown
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods (TestMethodTeardown)
|
||||
|
||||
function deleteSolution(self)
|
||||
clear self.phase;
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods
|
||||
|
||||
function check(self, name)
|
||||
try
|
||||
self.phase = Solution('duplicate-reactions.yaml', name);
|
||||
catch ME
|
||||
self.verifySubstring(ME.identifier, 'Cantera:ctError');
|
||||
self.verifySubstring(ME.message, 'duplicate reaction');
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
methods (Test)
|
||||
|
||||
function testForwardMultiple(self)
|
||||
self.check('A');
|
||||
end
|
||||
|
||||
function testOpposite1(self)
|
||||
self.check('B');
|
||||
end
|
||||
|
||||
function testOpposite2(self)
|
||||
self.check('C');
|
||||
end
|
||||
|
||||
function testOpposite3(self)
|
||||
self.check('D');
|
||||
end
|
||||
|
||||
function testOpposite4(self)
|
||||
self.check('E');
|
||||
self.verifyEqual(self.phase.nReactions, 2);
|
||||
end
|
||||
|
||||
function testCommonEfficiencies(self)
|
||||
self.check('F');
|
||||
end
|
||||
|
||||
function testDisjointEfficiencies(self)
|
||||
self.check('G');
|
||||
self.verifyEqual(self.phase.nReactions, 2);
|
||||
end
|
||||
|
||||
function testDifferentType(self)
|
||||
self.check('H');
|
||||
self.verifyEqual(self.phase.nReactions, 2);
|
||||
end
|
||||
|
||||
function testDeclaredDupliate(self)
|
||||
self.check('I');
|
||||
self.verifyEqual(self.phase.nReactions, 2);
|
||||
end
|
||||
|
||||
function testUnmatchedDuplicate(self)
|
||||
self.check('J');
|
||||
end
|
||||
|
||||
function testNonreactingSpecies(self)
|
||||
self.check('K');
|
||||
self.verifyEqual(self.phase.nReactions, 3);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user