Skip to content

Commit

Permalink
Added second test for getClosestAtom(), now with more than two atoms
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Feb 21, 2010
1 parent 7a1b919 commit 5724205
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/org/openscience/cdk/geometry/GeometryToolsTest.java
Expand Up @@ -397,6 +397,25 @@ public class GeometryToolsTest extends CDKTestCase {
Assert.assertEquals(GeometryTools.getLength2D(bond),2.23,0.01);
}

@Test public void testGetClosestAtom_Multiatom() {
IAtom atom1 = new Atom("C");
atom1.setPoint2d(new Point2d(-1,-1));
IAtom atom2 = new Atom("C");
atom2.setPoint2d(new Point2d(1,0));
IAtom atom3 = new Atom("C");
atom3.setPoint2d(new Point2d(5,0));
IAtomContainer acont = new AtomContainer();
acont.addAtom(atom1);
acont.addAtom(atom2);
acont.addAtom(atom3);
Assert.assertEquals(atom2, GeometryTools.getClosestAtom(acont, atom1));
Assert.assertEquals(atom1, GeometryTools.getClosestAtom(acont, atom2));
Assert.assertEquals(atom2, GeometryTools.getClosestAtom(acont, atom3));
}

/**
* Tests if not the central atom is returned as closest atom.
*/
@Test public void testGetClosestAtom_IAtomContainer_IAtom() {
IAtom atom1 = new Atom("C");
atom1.setPoint2d(new Point2d(-1,-1));
Expand Down

0 comments on commit 5724205

Please sign in to comment.