fpValueCheck detects (invalid) decimal ponts in exponents
This commit is contained in:
parent
4a6dd84f81
commit
43546f870f
2 changed files with 8 additions and 0 deletions
|
|
@ -79,6 +79,10 @@ class TestThermoPhase(utilities.CanteraTest):
|
|||
self.phase.X = 'H2:1e-x4'
|
||||
self.assertArrayNear(X0, self.phase.X)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
self.phase.X = 'H2:1e-1.4'
|
||||
self.assertArrayNear(X0, self.phase.X)
|
||||
|
||||
def test_report(self):
|
||||
report = self.phase.report()
|
||||
self.assertTrue(self.phase.name in report)
|
||||
|
|
|
|||
|
|
@ -252,6 +252,10 @@ doublereal fpValueCheck(const std::string& val)
|
|||
throw CanteraError("fpValueCheck",
|
||||
"string has more than one .");
|
||||
}
|
||||
if (numExp > 0) {
|
||||
throw CanteraError("fpValueCheck",
|
||||
"string has decimal point in exponent");
|
||||
}
|
||||
} else if (ch == 'e' || ch == 'E' || ch == 'd' || ch == 'D') {
|
||||
numExp++;
|
||||
str[i] = 'E';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue