@@ -1214,24 +1214,24 @@ public void testImplicitH() throws Exception {
12141214 Assert .assertEquals ("C6H6" , MolecularFormulaManipulator .getString (f ));
12151215
12161216 }
1217-
1217+
12181218 @ Test public void noNullPointerExceptionForExactMassOfRGroups () throws Exception {
12191219 IMolecularFormula formula = new MolecularFormula ();
12201220 formula .addIsotope (new Isotope ("C" ));
12211221 formula .addIsotope (new Isotope ("H" ), 3 );
12221222 formula .addIsotope (new Isotope ("R" ));
12231223 assertThat (MolecularFormulaManipulator .getTotalExactMass (formula ),
12241224 closeTo (15.0234 , 0.01 ));
1225- }
1226-
1225+ }
1226+
12271227 @ Test public void noNullPointerExceptionForMassOfRGroups () throws Exception {
12281228 IMolecularFormula formula = new MolecularFormula ();
12291229 formula .addIsotope (new Isotope ("C" ));
12301230 formula .addIsotope (new Isotope ("H" ), 3 );
12311231 formula .addIsotope (new Isotope ("R" ));
12321232 assertThat (MolecularFormulaManipulator .getTotalMassNumber (formula ),
12331233 closeTo (15.0 , 0.01 ));
1234- }
1234+ }
12351235
12361236 @ Test public void noNullPointerExceptionForMajorMassOfRGroups () throws Exception {
12371237 IMolecularFormula formula = new MolecularFormula ();
@@ -1249,7 +1249,7 @@ public void testImplicitH() throws Exception {
12491249 mf .addIsotope (carbon , 10 );
12501250 MolecularFormulaManipulator .getNaturalExactMass (mf );
12511251 }
1252-
1252+
12531253 @ Test public void acceptMinusAsInput () throws Exception {
12541254 IChemObjectBuilder bldr = SilentChemObjectBuilder .getInstance ();
12551255 IMolecularFormula mf = MolecularFormulaManipulator .getMolecularFormula ("[PO4]3–" ,
@@ -1387,6 +1387,25 @@ public void getMostAbundant() {
13871387 is ("[12]C6[79]Br3[81]Br3" ));
13881388 }
13891389
1390+
1391+ private static void assertMass (String str , double expMass , int flav ) {
1392+ IChemObjectBuilder bldr = SilentChemObjectBuilder .getInstance ();
1393+ IMolecularFormula mf =
1394+ MolecularFormulaManipulator .getMolecularFormula (str , bldr );
1395+ double act = MolecularFormulaManipulator .getMass (mf , flav );
1396+ assertThat (act , is (closeTo (expMass , 0.01 )));
1397+ }
1398+
1399+ @ Test
1400+ public void C6Br6 () {
1401+ assertMass ("C6Br6" , 551.485 , MolWeight );
1402+ assertMass ("C6Br6" , 545.510 , MonoIsotopic );
1403+ assertMass ("C6Br6" , 551.503 , MostAbundant );
1404+ assertMass ("[12]C4[13]C2Br6" , 553.427 , MolWeight );
1405+ assertMass ("[12]C4[13]C2Br6" , 547.516 , MonoIsotopic );
1406+ assertMass ("[12]C4[13]C2Br6" , 553.510 , MostAbundant );
1407+ }
1408+
13901409 // Iron has 4 stable isotopes, 54 @ 5.85%, 56 @ 91.57%, 57 @ 2.12%, and
13911410 // 58 @ 0.28%. Given 100 iron's we expected ~6 @ 54, ~92 @ 56 and 2 @ 57
13921411 @ Test
0 commit comments