Switch MATLAB tests to use Solution

Instead of deprecated importPhase
This commit is contained in:
Bryan W. Weber 2017-01-06 10:25:42 -05:00 committed by Ray Speth
parent 74a583a6d0
commit d735cf0017
2 changed files with 8 additions and 8 deletions

View file

@ -11,7 +11,7 @@ classdef TestThermo < TestCase
function setUp(self)
global staticTestThermoGas
if isempty(staticTestThermoGas)
staticTestThermoGas = importPhase('../data/steam-reforming.xml', 'full');
staticTestThermoGas = Solution('../data/steam-reforming.xml', 'full');
end
self.gas = staticTestThermoGas;
set(self.gas, 'T', 300, 'P', oneatm, 'Y', [0.5, 0, 0.5, 0, 0, 0, 0]);
@ -38,7 +38,7 @@ classdef TestThermo < TestCase
assertEqual(i, speciesIndex(self.gas, name))
end
end
function test_nAtoms(self)
assertEqual(nAtoms(self.gas, 1, 3), 4)
assertEqual(nAtoms(self.gas, 1, 4), 0)
@ -46,7 +46,7 @@ classdef TestThermo < TestCase
assertExceptionThrown(@() nAtoms(self.gas, 2, 5), '')
assertExceptionThrown(@() nAtoms(self.gas, 8, 1), '')
end
function testSetState(self)
u0 = intEnergy_mass(self.gas);
h0 = enthalpy_mass(self.gas);
@ -54,15 +54,15 @@ classdef TestThermo < TestCase
v0 = 1/density(self.gas);
T0 = temperature(self.gas);
P0 = pressure(self.gas);
set(self.gas, 'T', 400, 'P', 5*oneatm);
assertAlmostEqual(temperature(self.gas), 400)
assertAlmostEqual(pressure(self.gas), 5*oneatm)
set(self.gas, 'H', h0, 'P', P0);
assertAlmostEqual(temperature(self.gas), T0, 1e-8)
assertAlmostEqual(entropy_mass(self.gas), s0, 1e-8)
set(self.gas, 'T', 400, 'P', 5*oneatm);
set(self.gas, 'U', u0, 'V', v0);
assertAlmostEqual(pressure(self.gas), P0, 1e-8)

View file

@ -2,12 +2,12 @@ function test_suite = testImport
initTestSuite;
function testImportXML
gas = importPhase('gri30.xml', 'gri30_mix');
gas = Solution('gri30.xml', 'gri30_mix');
dkm = mixDiffCoeffs(gas);
assertEqual(length(dkm), nSpecies(gas))
function testImportCTI
gas = importPhase('h2o2.cti');
gas = Solution('h2o2.cti');
assertEqual(temperature(gas), 300)
cleanup()