From: Egon W. <eg...@us...> - 2002-03-08 14:24:46
|
Update of /cvsroot/cdk/cdk/org/openscience/cdk/test/io/cml In directory usw-pr-cvs1:/tmp/cvs-serv7074/org/openscience/cdk/test/io/cml Modified Files: JumboTest.java Log Message: Added two more Jumbo3 test files. Index: JumboTest.java =================================================================== RCS file: /cvsroot/cdk/cdk/org/openscience/cdk/test/io/cml/JumboTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** JumboTest.java 8 Mar 2002 13:54:39 -0000 1.1 --- JumboTest.java 8 Mar 2002 14:24:42 -0000 1.2 *************** *** 37,42 **** /** ! * TestCase for the reading CML files. ! * */ public class JumboTest extends TestCase { --- 37,43 ---- /** ! * TestCase for the reading CML files using a few test files ! * in data/cmltest as found in the original Jumbo3 release ! * (http://www.xml-cml.org/). */ public class JumboTest extends TestCase { *************** *** 58,64 **** */ public void testCuran() { try { ! File f = new File("data/cmltest/curan.xml"); if (f.canRead()) { // read the file --- 59,72 ---- */ + + /** + * Special CML characteristics: + * - <atomArray></atom></atom></atomArray> + * - X2D only + */ public void testCuran() { + String filename = "data/cmltest/curan.xml"; try { ! File f = new File(filename); if (f.canRead()) { // read the file *************** *** 85,89 **** } else { System.out.println("The CMLReader was not tested with a CML file."); ! System.out.println("Due to missing file: data/cmltest/curan.xml"); } } catch (Exception e) { --- 93,178 ---- } else { System.out.println("The CMLReader was not tested with a CML file."); ! System.out.println("Due to missing file: " + filename); ! } ! } catch (Exception e) { ! fail(e.toString()); ! } ! } ! ! /** ! * Special CML characteristics: ! * - use of cml: namespace ! * - X2D only ! */ ! public void testCephNS() { ! String filename = "data/cmltest/ceph-ns.xml"; ! try { ! File f = new File(filename); ! if (f.canRead()) { ! // read the file ! CMLReader reader = new CMLReader(new FileReader(f)); ! ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile()); ! ! // test the resulting ChemFile content ! assertNotNull(chemFile); ! assertEquals(chemFile.getChemSequenceCount(), 1); ! ChemSequence seq = chemFile.getChemSequence(0); ! assertNotNull(seq); ! assertEquals(seq.getChemModelCount(), 1); ! ChemModel model = seq.getChemModel(0); ! assertNotNull(model); ! assertEquals(model.getSetOfMolecules().getMoleculeCount(), 1); ! ! // test the molecule ! Molecule mol = model.getSetOfMolecules().getMolecule(0); ! assertNotNull(mol); ! assertEquals(mol.getAtomCount(), 15); ! assertEquals(mol.getBondCount(), 16); ! assertTrue(!GeometryTools.has3DCoordinates(mol)); ! assertTrue(GeometryTools.has2DCoordinates(mol)); ! } else { ! System.out.println("The CMLReader was not tested with a CML file."); ! System.out.println("Due to missing file: " + filename); ! } ! } catch (Exception e) { ! fail(e.toString()); ! } ! } ! ! /** ! * Special CML characteristics: ! * - <atomArray><stringArray builtin="atomId"/></atomArray> ! * - <bondArray><stringArray builtin="atomRef"/></atomArray> ! * - no coords ! */ ! public void testNucleustest() { ! String filename = "data/cmltest/nucleustest.xml"; ! try { ! File f = new File(filename); ! if (f.canRead()) { ! // read the file ! CMLReader reader = new CMLReader(new FileReader(f)); ! ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile()); ! ! // test the resulting ChemFile content ! assertNotNull(chemFile); ! assertEquals(chemFile.getChemSequenceCount(), 1); ! ChemSequence seq = chemFile.getChemSequence(0); ! assertNotNull(seq); ! assertEquals(seq.getChemModelCount(), 1); ! ChemModel model = seq.getChemModel(0); ! assertNotNull(model); ! assertEquals(model.getSetOfMolecules().getMoleculeCount(), 1); ! ! // test the molecule ! Molecule mol = model.getSetOfMolecules().getMolecule(0); ! assertNotNull(mol); ! assertEquals(mol.getAtomCount(), 8); ! assertEquals(mol.getBondCount(), 12); ! assertTrue(!GeometryTools.has3DCoordinates(mol)); ! assertTrue(!GeometryTools.has2DCoordinates(mol)); ! } else { ! System.out.println("The CMLReader was not tested with a CML file."); ! System.out.println("Due to missing file: " + filename); } } catch (Exception e) { |