Check pressure units in metric are not set to PSI
This commit is contained in:
@@ -1382,6 +1382,7 @@ int DLLEXPORT EN_setoption(EN_Project p, int option, double value)
|
||||
unit = ROUND(value);
|
||||
if (unit < 0 || unit > METERS) return 205;
|
||||
if (p->parser.Unitsflag == US && unit > PSI) return 0;
|
||||
if (p->parser.Unitsflag == SI && unit == PSI) return 0;
|
||||
p->parser.Pressflag = unit;
|
||||
initunits(p);
|
||||
break;
|
||||
|
||||
@@ -183,6 +183,13 @@ BOOST_FIXTURE_TEST_CASE(test_pressure_units, FixtureInitClose)
|
||||
BOOST_REQUIRE(error == 0);
|
||||
BOOST_CHECK(abs(p - 298.76035) < 1.e-5);
|
||||
|
||||
// Set pressure to PSI and check that it remains in kPa
|
||||
error = EN_setoption(ph, EN_PRESS_UNITS, EN_PSI);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
error = EN_getoption(ph, EN_PRESS_UNITS, &units);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
BOOST_CHECK(units == EN_KPA);
|
||||
|
||||
error = EN_closeH(ph);
|
||||
BOOST_REQUIRE(error == 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user