Coverage Report - net.sourceforge.combean.test.graph.containers.TestNodeNumberingAdvisor
 
Classes in this File Line Coverage Branch Coverage Complexity
TestNodeNumberingAdvisor
89%
16/18
N/A
1
 
 1  
 /*
 2  
     This file is part of Combean.
 3  
 
 4  
     Combean is free software; you can redistribute it and/or modify
 5  
     it under the terms of the GNU General Public License as published by
 6  
     the Free Software Foundation; either version 2 of the License, or
 7  
     (at your option) any later version.
 8  
 
 9  
     Combean is distributed in the hope that it will be useful,
 10  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
     GNU General Public License for more details.
 13  
 
 14  
     You should have received a copy of the GNU General Public License
 15  
     along with Combean; if not, write to the Free Software
 16  
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 17  
 */
 18  
 /*
 19  
  * Created on 10.02.2005
 20  
  *
 21  
  */
 22  
 package net.sourceforge.combean.test.graph.containers;
 23  
 
 24  
 import junit.framework.TestCase;
 25  
 import net.sourceforge.combean.graph.containers.ArrayNodeNumbering;
 26  
 import net.sourceforge.combean.graph.containers.MapAsNodeNumbering;
 27  
 import net.sourceforge.combean.graph.containers.NodeNumberingAdvisor;
 28  
 import net.sourceforge.combean.interfaces.graph.containers.NodeNumbering;
 29  
 import net.sourceforge.combean.samples.simplegraphs.IsolatedNodes;
 30  
 import net.sourceforge.combean.samples.simplegraphs.NumberGraph;
 31  
 import net.sourceforge.combean.test.helpers.stubs.GraphWithoutProperties;
 32  
 
 33  
 /**
 34  
  * @author schickin
 35  
  *
 36  
  */
 37  
 public class TestNodeNumberingAdvisor extends TestCase {
 38  
     
 39  6
     private NumberGraph g = null;
 40  6
     private GraphWithoutProperties noPropGraph = null;
 41  
     
 42  
     public static void main(String[] args) {
 43  0
         junit.textui.TestRunner.run(TestNodeNumberingAdvisor.class);
 44  0
     }
 45  
 
 46  
     /*
 47  
      * @see TestCase#setUp()
 48  
      */
 49  
     protected void setUp() throws Exception {
 50  6
         super.setUp();
 51  
         
 52  6
         this.g = new IsolatedNodes(1);
 53  6
         this.noPropGraph = new GraphWithoutProperties();
 54  6
     }
 55  
 
 56  
     /*
 57  
      * @see TestCase#tearDown()
 58  
      */
 59  
     protected void tearDown() throws Exception {
 60  6
         super.tearDown();
 61  6
     }
 62  
 
 63  
     /**
 64  
      * Constructor for TestNodeNumberingAdvisor.
 65  
      * @param name
 66  
      */
 67  
     public TestNodeNumberingAdvisor(String name) {
 68  6
         super(name);
 69  6
     }
 70  
 
 71  
     public void testGetFastestNodeNumberingForIllegalGraph() {
 72  3
         NodeNumbering numbering =
 73  
             NodeNumberingAdvisor.getFastestNodeNumbering(this.noPropGraph);
 74  3
         assertTrue("best node numbering for a graph without special properties " +
 75  
                 "is a map",
 76  
                 numbering instanceof MapAsNodeNumbering);
 77  3
     }
 78  
 
 79  
     public void testGetFastestNodeNumberingForNumberGraph() {
 80  3
         NodeNumbering numbering =
 81  
             NodeNumberingAdvisor.getFastestNodeNumbering(this.g);
 82  3
         assertTrue("best node numbering for numbered nodes is an array",
 83  
                 numbering instanceof ArrayNodeNumbering);
 84  3
     }
 85  
 
 86  
 }