Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added two test cases for bugs in IsotopePatternGenerator. #251

Merged
merged 1 commit into from Nov 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -281,4 +281,36 @@ public void testCalculateIsotopesC20H30Fe2P2S4Cl4() {
IsotopePattern isos = isotopeGe.getIsotopes(molFor);
Assert.assertEquals(35, isos.getNumberOfIsotopes());
}

@Test
public void testGeneratorSavesState() {
IsotopePatternGenerator isogen = new IsotopePatternGenerator(.1);

IMolecularFormula mf1 = MolecularFormulaManipulator.getMolecularFormula("C6H12O6", builder);
IsotopePattern ip1 = isogen.getIsotopes(mf1);
Assert.assertEquals(1, ip1.getNumberOfIsotopes());

IMolecularFormula mf2 = MolecularFormulaManipulator.getMolecularFormula("C6H12O6", builder);
IsotopePattern ip2 = isogen.getIsotopes(mf2);
Assert.assertEquals(1, ip2.getNumberOfIsotopes());
}

@Test
public void testGetIsotopes_IMolecularFormula_Charged() {
IsotopePatternGenerator isogen = new IsotopePatternGenerator(.1);

IMolecularFormula mfPositive = MolecularFormulaManipulator.getMolecularFormula("C6H12O6Na", builder);
mfPositive.setCharge(1);
IsotopePattern ip1 = isogen.getIsotopes(mfPositive);
Assert.assertEquals(1, ip1.getNumberOfIsotopes());

isogen = new IsotopePatternGenerator(.1);
IMolecularFormula mfNeutral = MolecularFormulaManipulator.getMolecularFormula("C6H12O6Na", builder);
mfNeutral.setCharge(0);
IsotopePattern ip2 = isogen.getIsotopes(mfNeutral);
Assert.assertEquals(1, ip2.getNumberOfIsotopes());

Assert.assertNotEquals(ip1.getIsotope(0).getMass(), ip2.getIsotope(0).getMass());
}

}