29{
30 try
31 {
34 FAIL() << "Missing expected exception.";
35 }
36 catch (const std::exception & e)
37 {
38 std::string msg(e.what());
39 ASSERT_TRUE(
40 msg.find(
41 "GeochemistryUnitConverter: bad_name is not a basis, equilibrium or kinetic species") !=
42 std::string::npos)
43 << "Failed with unexpected error message: " << msg;
44 }
45
46 try
47 {
50 FAIL() << "Missing expected exception.";
51 }
52 catch (const std::exception & e)
53 {
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;
58 }
59
60 try
61 {
64 FAIL() << "Missing expected exception.";
65 }
66 catch (const std::exception & e)
67 {
68 std::string msg(e.what());
69 ASSERT_TRUE(
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;
73 }
74
75 try
76 {
79 FAIL() << "Missing expected exception.";
80 }
81 catch (const std::exception & e)
82 {
83 std::string msg(e.what());
84 ASSERT_TRUE(
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;
88 }
89
90 try
91 {
94 FAIL() << "Missing expected exception.";
95 }
96 catch (const std::exception & e)
97 {
98 std::string msg(e.what());
99 ASSERT_TRUE(
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;
103 }
104
105 try
106 {
109 FAIL() << "Missing expected exception.";
110 }
111 catch (const std::exception & e)
112 {
113 std::string msg(e.what());
114 ASSERT_TRUE(
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;
118 }
119}
const ModelGeochemicalDatabase mgd
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,...