Skip to content

Commit

Permalink
Merge pull request cdk#1127 from cdk/patch/stefhk3-patch-2-fix
Browse files Browse the repository at this point in the history
Patch/stefhk3 patch 2 fix
  • Loading branch information
johnmay authored Nov 12, 2024
2 parents dedc951 + ea01adf commit bb12124
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObject;
import org.openscience.cdk.test.CDKTestCase;
import org.openscience.cdk.interfaces.IAtom;
Expand Down Expand Up @@ -167,6 +168,21 @@ void testBond() throws Exception {
Assertions.assertEquals("a2", atom2.getID());
}

@Test
void testBondOrders() throws Exception {
String cmlString = "<molecule id='m1'><atomArray><atom id='a1'/><atom id='a2'/><atom id='a3'/></atomArray><bondArray><bond id='b1' atomRefs2='a1 a2'/><bond id='b2' atomRefs2='a1 a3' order='D'/></bondArray></molecule>";

IChemFile chemFile = parseCMLString(cmlString);
IAtomContainer mol = checkForSingleMoleculeFile(chemFile);

Assertions.assertEquals(3, mol.getAtomCount());
Assertions.assertEquals(2, mol.getBondCount());
org.openscience.cdk.interfaces.IBond bond = mol.getBond(0);
Assertions.assertNull(bond.getOrder());
bond = mol.getBond(1);
Assertions.assertEquals(IBond.Order.DOUBLE, bond.getOrder());
}

@Test
void testBond2() throws Exception {
String cmlString = "<molecule id='m1'><atomArray><stringArray builtin='id'>a1 a2</stringArray></atomArray><bondArray><stringArray builtin='atomRefs'>a1</stringArray><stringArray builtin='atomRefs'>a2</stringArray></bondArray></molecule>";
Expand Down

0 comments on commit bb12124

Please sign in to comment.