Skip to content

Commit

Permalink
Some corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Oct 11, 2018
1 parent 6819a15 commit 1834bef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static String getString(IMolecularFormula formula, String[] orderElements
stringMF.append(q);
stringMF.append('+');
} else {
if (q < 1)
if (q < -1)
stringMF.append(-q);
stringMF.append('-');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ public void test5() {
IMolecularFormula ff = MolecularFormulaManipulator.getMolecularFormula(formula, builder);
Assert.assertTrue(MolecularFormulaManipulator.compare(formula1,
MolecularFormulaManipulator.getMolecularFormula(formula, builder)));
Assert.assertEquals("O3S", MolecularFormulaManipulator.getString(ff));
Assert.assertEquals("[O3S]2-", MolecularFormulaManipulator.getString(ff));
Assert.assertEquals(-2, ff.getCharge(), 0.00001);
}

Expand Down Expand Up @@ -1257,7 +1257,7 @@ public void testImplicitH() throws Exception {
IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("C6H6O", bldr);
assertTrue(MolecularFormulaManipulator.adjustProtonation(mf, -1));
assertThat(MolecularFormulaManipulator.getString(mf), is("C6H5O"));
assertThat(MolecularFormulaManipulator.getString(mf), is("[C6H5O]-"));
assertThat(mf.getCharge(), is(-1));
}

Expand All @@ -1283,7 +1283,7 @@ public void testImplicitH() throws Exception {
IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("HCl", bldr);
assertTrue(MolecularFormulaManipulator.adjustProtonation(mf, -1));
assertThat(MolecularFormulaManipulator.getString(mf), is("Cl"));
assertThat(MolecularFormulaManipulator.getString(mf), is("[Cl]-"));
assertThat(mf.getCharge(), is(-1));
assertThat(mf.getIsotopeCount(), is(1));
}
Expand Down

0 comments on commit 1834bef

Please sign in to comment.