From: Ulrich B. <zzz...@us...> - 2004-07-24 18:43:07
|
Update of /cvsroot/cdk/cdk/src/org/openscience/cdk/test/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6454/src/org/openscience/cdk/test/graph Added Files: MinimalPathIteratorTest.java BiconnectivityInspectorTest.java Log Message: added JavaDoc & copyright to SSSRFinder related classes fixed the getConnectionMatrix() and addBonds() problems --- NEW FILE: MinimalPathIteratorTest.java --- /* $RCSfile: MinimalPathIteratorTest.java,v $ * $Author: zzzgggrrr $ * $Date: 2004/07/24 18:42:53 $ * $Revision: 1.1 $ * * Copyright (C) 2004 The Chemistry Development Kit (CDK) project * * Contact: cdk...@li... * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * All we ask is that proper credit is given for our work, which includes * - but is not limited to - adding the above copyright notice to the beginning * of your source code files, and to any copyright notice that you may distribute * with programs based on this work. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.openscience.cdk.test.graph; import java.util.List; import org._3pq.jgrapht.graph.SimpleGraph; import org.openscience.cdk.graph.MinimalPathIterator; import junit.framework.TestCase; /** * This class tests the MinimalPathIteratorTest class. * * @cdk.module test * * @author Ulrich Bauer <ba...@cs...> */ public class MinimalPathIteratorTest extends TestCase { public void testMinimalPathIterator() { SimpleGraph g = new SimpleGraph( ); g.addVertex( "a" ); g.addVertex( "b" ); g.addVertex( "c" ); g.addVertex( "d" ); g.addVertex( "e" ); g.addVertex( "f" ); g.addVertex( "g" ); g.addVertex( "h" ); g.addVertex( "i" ); g.addVertex( "j" ); g.addVertex( "k" ); g.addVertex( "l" ); g.addEdge( "a", "b" ); g.addEdge( "b", "c" ); g.addEdge( "c", "d" ); g.addEdge( "a", "e" ); g.addEdge( "b", "f" ); g.addEdge( "c", "g" ); g.addEdge( "d", "h" ); g.addEdge( "e", "f" ); g.addEdge( "f", "g" ); g.addEdge( "g", "h" ); g.addEdge( "e", "i" ); g.addEdge( "f", "j" ); g.addEdge( "g", "k" ); g.addEdge( "h", "l" ); g.addEdge( "i", "j" ); g.addEdge( "j", "k" ); g.addEdge( "k", "l" ); int count = 0; for (MinimalPathIterator i = new MinimalPathIterator(g, "a", "l"); i.hasNext();) { assertTrue(((List)i.next()).size() == 5); count++; } assertTrue(count == 10); } } --- NEW FILE: BiconnectivityInspectorTest.java --- /* $RCSfile: BiconnectivityInspectorTest.java,v $ * $Author: zzzgggrrr $ * $Date: 2004/07/24 18:42:53 $ * $Revision: 1.1 $ * * Copyright (C) 2004 The Chemistry Development Kit (CDK) project * * Contact: cdk...@li... * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * All we ask is that proper credit is given for our work, which includes * - but is not limited to - adding the above copyright notice to the beginning * of your source code files, and to any copyright notice that you may distribute * with programs based on this work. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.openscience.cdk.test.graph; import java.util.List; import junit.framework.TestCase; import org._3pq.jgrapht.graph.SimpleGraph; import org.openscience.cdk.graph.BiconnectivityInspector; /** * This class tests the BiconnectivityInspector class. * * @cdk.module test * * @author Ulrich Bauer <ba...@cs...> */ public class BiconnectivityInspectorTest extends TestCase { public void testBiconnectedSets() { SimpleGraph g = new SimpleGraph( ); g.addVertex( "a" ); g.addVertex( "b" ); g.addVertex( "c" ); g.addVertex( "d" ); g.addVertex( "e" ); g.addVertex( "f" ); g.addVertex( "g" ); g.addVertex( "h" ); g.addVertex( "i" ); g.addVertex( "j" ); g.addVertex( "k" ); g.addEdge( "a", "b" ); g.addEdge( "a", "c" ); g.addEdge( "b", "c" ); g.addEdge( "b", "d" ); g.addEdge( "c", "d" ); g.addEdge( "d", "e" ); g.addEdge( "d", "g" ); g.addEdge( "e", "f" ); g.addEdge( "e", "h" ); g.addEdge( "f", "h" ); g.addEdge( "i", "j" ); g.addEdge( "i", "k" ); g.addEdge( "j", "k" ); BiconnectivityInspector bci = new BiconnectivityInspector(g); List connectedSets = bci.biconnectedSets(); assertTrue(connectedSets.size() == 5); } } |