Coverage Report - net.sourceforge.combean.test.graph.containers.TestArrayNodeNumbering
 
Classes in this File Line Coverage Branch Coverage Complexity
TestArrayNodeNumbering
100%
20/20
100%
2/2
1,2
 
 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.NumberNode;
 26  
 import net.sourceforge.combean.graph.containers.ArrayNodeNumbering;
 27  
 import net.sourceforge.combean.interfaces.graph.containers.NodeNumbering;
 28  
 import net.sourceforge.combean.samples.simplegraphs.IsolatedNodes;
 29  
 
 30  
 /**
 31  
  * @author schickin
 32  
  *
 33  
  */
 34  
 public class TestArrayNodeNumbering extends TestCase {
 35  
     
 36  6
     private NodeNumbering numbering = null;
 37  
 
 38  
     private static final int NUMNODES = 5;
 39  
     private static final int TESTNODE = 2;
 40  6
     private IsolatedNodes graph = null;
 41  6
     private NumberNode v = null;
 42  
 
 43  
     /*
 44  
      * @see TestCase#setUp()
 45  
      */
 46  
     protected void setUp() throws Exception {
 47  6
         super.setUp();
 48  
         
 49  6
         this.numbering = new ArrayNodeNumbering();
 50  6
         this.graph = new IsolatedNodes(NUMNODES);
 51  6
         this.v = new NumberNode(TESTNODE);
 52  
 
 53  6
         this.numbering.init(this.graph);
 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 TestArrayNodeNumbering.
 65  
      * @param name
 66  
      */
 67  
     public TestArrayNodeNumbering(String name) {
 68  6
         super(name);
 69  6
     }
 70  
 
 71  
     public final void testSetAndGetNumber() {
 72  3
         this.numbering.setNumber(this.v, 1000);
 73  3
         assertEquals("value that has been set must be retrieved",
 74  
                 1000, this.numbering.getNumber(this.v));
 75  3
     }
 76  
 
 77  
     public final void testFill() {
 78  3
         this.numbering.fill(10);
 79  18
         for (int i = 0; i < NUMNODES; i++) {
 80  15
             assertEquals("all values must be equal to 10",
 81  
                     10, this.numbering.getNumber(new NumberNode(i)));
 82  
         }
 83  3
     }
 84  
 }