Changes in src/unittests/FormulaUnittest.cpp [3d27e6:997b2a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/FormulaUnittest.cpp
r3d27e6 r997b2a 185 185 } 186 186 { 187 Formula formula("CH2(COOH)2"); 188 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)4); 189 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)4); 190 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)3); 191 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0); 192 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0); 193 } 194 { 195 Formula formula("K4[Fe(CN)6]"); 196 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0); 197 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0); 198 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)6); 199 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0); 200 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0); 201 CPPUNIT_ASSERT_EQUAL(formula["K"],(unsigned int)4); 202 CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1); 203 CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)6); 204 } 205 { 206 Formula formula("[CrCl3(H2O)3]"); 207 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)6); 208 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)3); 209 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)0); 210 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0); 211 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0); 212 CPPUNIT_ASSERT_EQUAL(formula["Cr"],(unsigned int)1); 213 CPPUNIT_ASSERT_EQUAL(formula["Cl"],(unsigned int)3); 214 } 215 { 216 Formula formula("Mg3[Fe(CN)6]2"); 217 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0); 218 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0); 219 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)12); 220 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0); 221 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0); 222 CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)3); 223 CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)2); 224 CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)12); 225 } 226 { 227 Formula formula("Na[Fe((HO2CCH2)2NCH2CH2N(CH2CO2H)2)]"); 228 CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)16); 229 CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)8); 230 CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)10); 231 CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)1); 232 CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0); 233 CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)0); 234 CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1); 235 CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)2); 236 } 237 { 187 238 CPPUNIT_ASSERT_THROW(Formula formula("74107"),ParseError); 188 239 CPPUNIT_ASSERT_THROW(Formula formula(" "),ParseError); … … 192 243 CPPUNIT_ASSERT_THROW(Formula formula("1NaCl"),ParseError); 193 244 CPPUNIT_ASSERT_THROW(Formula formula("Mag"),ParseError); 245 CPPUNIT_ASSERT_THROW(Formula formula("AgCl)"),ParseError); 246 CPPUNIT_ASSERT_THROW(Formula formula("(Na"),ParseError); 247 CPPUNIT_ASSERT_THROW(Formula formula("(Mag)"),ParseError); 248 CPPUNIT_ASSERT_THROW(Formula formula("MgCl2)"),ParseError); 249 CPPUNIT_ASSERT_THROW(Formula formula("((MgCl2)"),ParseError); 250 CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2))"),ParseError); 251 CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2]"),ParseError); 252 CPPUNIT_ASSERT_THROW(Formula formula("[MgCl2)"),ParseError); 253 CPPUNIT_ASSERT_THROW(Formula formula("N(aCl"),ParseError); 254 CPPUNIT_ASSERT_THROW(Formula formula("Na()Cl"),ParseError); 194 255 } 195 256
Note:
See TracChangeset
for help on using the changeset viewer.