package cs437.som.neighborhood;

import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

public class CompoundNeighborhoodTest {
    private static final double MAXIMUM_DIFFERENCE = 0.0000000000000001;
    private static final int CROSSOVER_POINT = 500;
    private static final int FIRST_VALUE = 10;
    private static final int SECOND_VALUE = 2;

    @Test
    public void testNeighborhoodWidth() throws Exception {
        ConstantNeighborhoodWidthFunction cnwf0 =
                new ConstantNeighborhoodWidthFunction(FIRST_VALUE);
        cnwf0.setExpectedIterations(CROSSOVER_POINT);
        ConstantNeighborhoodWidthFunction cnwf1 =
                new ConstantNeighborhoodWidthFunction(SECOND_VALUE);
        cnwf1.setExpectedIterations(CROSSOVER_POINT);
        CompoundNeighborhood cn = new CompoundNeighborhood(cnwf0);
        cn.addNeighborhood(cnwf1, CROSSOVER_POINT);

        for (int i = 0; i < CROSSOVER_POINT; i++) {
            assertEquals(cn.neighborhoodWidth(i), FIRST_VALUE,
                    MAXIMUM_DIFFERENCE);
        }

        for (int j = 0; j < CROSSOVER_POINT; j++) {
            assertEquals(cn.neighborhoodWidth(j + CROSSOVER_POINT),
                    FIRST_VALUE, MAXIMUM_DIFFERENCE);
        }
    }
}

@@ -26,16 +26,58 @@
 rhood;%0A%0A
+import org.testng.annotations.BeforeTest;%0A
 import o
@@ -420,138 +420,205 @@
     
-@Test%0A    public void testNeighborhoodWidth() throws Exception %7B%0A        ConstantNeighborhoodWidthFunction cnwf0 =%0A               
+private ConstantNeighborhoodWidthFunction cnwf0;%0A    private ConstantNeighborhoodWidthFunction cnwf1;%0A    private CompoundNeighborhood cn;%0A%0A    @BeforeTest%0A    public void setUp() %7B%0A        cnwf0 =
  new
@@ -732,65 +732,15 @@
     
-ConstantNeighborhoodWidthFunction cnwf1 =%0A               
+cnwf1 =
  new
@@ -851,37 +851,16 @@
         
-CompoundNeighborhood 
 cn = new
@@ -941,16 +941,84 @@
 POINT);%0A
+    %7D%0A%0A    @Test%0A    public void testFirstChild() throws Exception %7B
 %0A       
@@ -1172,24 +1172,76 @@
 ;%0A        %7D%0A
+    %7D%0A%0A    @Test%0A    public void testSecondChild() %7B
 %0A        for

Split tests into seperate methods in CompoundNeighborhoodTest.