-
Notifications
You must be signed in to change notification settings - Fork 5
ami _tests
AMI has several thousand Junit
tests. Many are true unit tests (e.g. in euclid
), others are Test-Driven-Development, others are Regression Tests, and some are educational. Because much of ami
's input and output is complex and unpredictable a significant fraction is fragile and tends to break over time. PMR is now gradually trying to weed out obsolete tests and tests which are hard to maintain. I am gradually building testing tools to compare outputs with expected content.
The bulk of new Tests is aimed at supporting ami
and amidict
commands; one class per AMITool command and so one Test class per command. (This is independent of the many legacy tests such as euclid
, pdf2svg2
, svg
etc. which may be necessary when the higher level tests break.)
Ideally each ami
Tool module will have a test of the form <class>Test
. These tests are now inherited in the hierarchy:
AbstractAMITest
... AMIFooTest
... AMIBarTest
and
... AbstractAMIDictTest
... AMIPlughTest
... AMIBazTest
The hierarchy means that test-helper code (e.g. to name and interrogate content) can be inherited for each test. (There may be a time when we refactor this to new classes).
org.contentmine.cproject.util.CMineTestFixtures
contains utilities:
pre-deletes targetDir
and copies a directory (usually from src/test/resources/
) into it.
Creates snippets tree. Maybe obsolete.
A wide range of comparison methods of compound objects, especially from euclid
. Includes provision for floats, whitespace, ordering, etc.
some examples:
assertEquals(String, Line3, Line3, double)
assertEquals(String, Plane3, Plane3, double)
assertEquals(String, Point3, Point3, double)
assertEquals(String, Point3, Vector3, Line3, double)
assertEquals(String, Point3Vector, Point3Vector, double)
assertEquals(String, Real2, Real2, double)
assertEqualsCanonically(String, Element, Element, boolean)
assertEqualsCanonically(String, Element, Element, boolean, boolean)
assertEqualsCanonically(String, Node, Node)
assertEqualsCanonically(String, String, Element, boolean)
assertEqualsIncludingFloat(String, Node, Node, boolean, double)
assertEqualsIncludingFloat(String, Node, Node, boolean, double, boolean)
assertEqualsIncludingFloat(String, Node, Node, double)
assertEqualsIncludingFloat(String, String, Node, boolean, double)
assertNotEquals(String, double[], double[], double)
assertNotEquals(String, int[], int[])
assertNotEquals(String, String[], String[])
assertNotEqualsCanonically(String, Node, Node)
assertObjectivelyEquals(String, double[], double[], double)