28TEST(GeochemistryUnitConverterTest, exceptions)
34 FAIL() <<
"Missing expected exception.";
36 catch (
const std::exception & e)
38 std::string msg(e.what());
41 "GeochemistryUnitConverter: bad_name is not a basis, equilibrium or kinetic species") !=
43 <<
"Failed with unexpected error message: " << msg;
50 FAIL() <<
"Missing expected exception.";
52 catch (
const std::exception & e)
54 std::string msg(e.what());
55 ASSERT_TRUE(msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species Ca++ because "
56 "it is not a mineral") != std::string::npos)
57 <<
"Failed with unexpected error message: " << msg;
64 FAIL() <<
"Missing expected exception.";
66 catch (
const std::exception & e)
68 std::string msg(e.what());
70 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species CO3-- because "
71 "it is not a mineral") != std::string::npos)
72 <<
"Failed with unexpected error message: " << msg;
79 FAIL() <<
"Missing expected exception.";
81 catch (
const std::exception & e)
83 std::string msg(e.what());
85 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species CH4(g) because "
86 "it is not a mineral") != std::string::npos)
87 <<
"Failed with unexpected error message: " << msg;
94 FAIL() <<
"Missing expected exception.";
96 catch (
const std::exception & e)
98 std::string msg(e.what());
100 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species (O-phth)-- because "
101 "it is not a mineral") != std::string::npos)
102 <<
"Failed with unexpected error message: " << msg;
109 FAIL() <<
"Missing expected exception.";
111 catch (
const std::exception & e)
113 std::string msg(e.what());
115 msg.find(
"GeochemistryUnitConverter: Cannot use CM3 units for species >(s)FeO- because "
116 "it is not a mineral") != std::string::npos)
117 <<
"Failed with unexpected error message: " << msg;
const PertinentGeochemicalSystem model(db, {"H2O", "Ca++", "HCO3-", "H+", ">(s)FeOH", "Fe++", "CH4(aq)", "O2(aq)", ">(w)FeOH"}, {"Calcite", "Fe(OH)3(ppd)"}, {"CH4(g)"}, {"Something"}, {"(O-phth)--"}, {">(s)FeO-"}, "O2(aq)", "e-")
const GeochemicalDatabaseReader db("database/moose_testdb.json", true, true, false)
Real fromMoles(Real moles, const GeochemistryUnit unit, const std::string &species_name, const ModelGeochemicalDatabase &mgd)
Calculates the amount of "unit"s of species_name in 1 mole, OR in 1 molal, whichever is appropriate.
Real toMoles(Real quantity, const GeochemistryUnit unit, const std::string &species_name, const ModelGeochemicalDatabase &mgd)
Calculates the amount of moles corresponding to "quantity" "unit"s of species name,...