Skip to content

Commit

Permalink
Added test to assert that two Vector3d's are identical
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Aug 1, 2010
1 parent 004770a commit 6651956
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/test/org/openscience/cdk/CDKTestCase.java
Expand Up @@ -33,6 +33,8 @@

import javax.vecmath.Point2d;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;

import java.util.Iterator;

/**
Expand Down Expand Up @@ -101,7 +103,7 @@ public void assertEquals(Point2d p1, Point2d p2, double error) {
Assert.assertEquals(p1.x, p2.x, error);
Assert.assertEquals(p1.y, p2.y, error);
}

/**
* Compares two Point3d objects, and asserts that the XY coordinates
* are identical within the given error.
Expand All @@ -118,6 +120,22 @@ public void assertEquals(Point3d p1, Point3d p2, double error) {
Assert.assertEquals(p1.z, p2.z, error);
}

/**
* Compares two Vector3d objects, and asserts that the XYZ coordinates
* are identical within the given error.
*
* @param v1 first Point3d
* @param v2 second Point3d
* @param error maximal allowed error
*/
public void assertEquals(Vector3d v1, Vector3d v2, double error) {
Assert.assertNotNull("The expected Vector3d is null", v1);
Assert.assertNotNull("The tested Vector3d is null", v2);
Assert.assertEquals(v1.x, v2.x, error);
Assert.assertEquals(v1.y, v2.y, error);
Assert.assertEquals(v1.z, v2.z, error);
}

/**
* Tests method that asserts that for all atoms an reasonable CDK atom
* type can be perceived.
Expand Down

0 comments on commit 6651956

Please sign in to comment.