/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ucp.plan;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import ucp.model.UcpMetrics;

/**
 *
 * @author Trifolium Alpestre
 */
public class UcpAlgorithmTest {

    public UcpAlgorithmTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test1 of apply method, of class UcpAlgorithm.
     */
    @Test
    public void test1Apply() {
        
        System.out.println("apply1");
        UcpMetrics metrics = new UcpMetrics();
        UcpAlgorithm instance = new UcpAlgorithm();

        int[] ef = {0,1,3,4,5,4,0,2};
        int[] tf = {2,1,2,4,2,4,2,0,1,4,2,3,5};
        metrics.setComplexity(10);
        metrics.setHoursPerUc(30);
        metrics.setE(ef);
        metrics.setT(tf);
        
        instance.apply(metrics);

        assertEquals(8.325999999999999, metrics.getUcp());
        assertEquals(20.0, metrics.getSchneiderwinters());
        assertEquals(249.77999999999997, metrics.getHours());
        assertEquals(166.51999999999998, metrics.getHoursSW());
    }

    /**
     * Test2 of apply method, of class UcpAlgorithm.
     */
    @Test
    public void test2Apply() {
        
        System.out.println("apply2");
        UcpMetrics metrics = new UcpMetrics();
        UcpAlgorithm instance = new UcpAlgorithm();

        int[] ef = {0,0,0,0,0,0,0,0};
        int[] tf = {0,0,0,0,0,0,0,0,0,0,0,0,0};
        metrics.setComplexity(10);
        metrics.setHoursPerUc(30);
        metrics.setE(ef);
        metrics.setT(tf);
        
        instance.apply(metrics);

        assertEquals(8.399999999999999, metrics.getUcp());
        assertEquals(20.0, metrics.getSchneiderwinters());
        assertEquals(251.99999999999994, metrics.getHours());
        assertEquals(167.99999999999997, metrics.getHoursSW());
    }    
    
    /**
     * Test3 of apply method, of class UcpAlgorithm.
     */
    @Test
    public void test3Apply() {
        
        System.out.println("apply3");
        UcpMetrics metrics = new UcpMetrics();
        UcpAlgorithm instance = new UcpAlgorithm();

        int[] ef = {5,5,5,5,5,5,5,5};
        int[] tf = {5,5,5,5,5,5,5,5,5,5,5,5,5};
        metrics.setComplexity(10);
        metrics.setHoursPerUc(30);
        metrics.setE(ef);
        metrics.setT(tf);
        
        instance.apply(metrics);

        assertEquals(9.7875, metrics.getUcp());
        assertEquals(36.0, metrics.getSchneiderwinters());
        assertEquals(293.625, metrics.getHours());
        assertEquals(352.34999999999997, metrics.getHoursSW());
    }   
 
    /**
     * Test4 of apply method, of class UcpAlgorithm.
     */
    @Test
    public void test4Apply() {
        
        System.out.println("apply4");
        UcpMetrics metrics = new UcpMetrics();
        UcpAlgorithm instance = new UcpAlgorithm();

        int[] ef = {5,5,5,5,5,5,5,5};
        int[] tf = {5,5,5,5,5,5,5,5,5,5,5,5,5};
        metrics.setComplexity(0);
        metrics.setHoursPerUc(30);
        metrics.setE(ef);
        metrics.setT(tf);
        
        instance.apply(metrics);

        assertEquals(0.0, metrics.getUcp());
        assertEquals(36.0, metrics.getSchneiderwinters());
        assertEquals(0.0, metrics.getHours());
        assertEquals(0.0, metrics.getHoursSW());
    }       

    /**
     * Test5 of apply method, of class UcpAlgorithm.
     */
    @Test
    public void test5Apply() {
        
        System.out.println("apply5");
        UcpMetrics metrics = new UcpMetrics();
        UcpAlgorithm instance = new UcpAlgorithm();

        int[] ef = {0,1,3,4,5,4,0,2};
        int[] tf = {2,1,2,4,2,4,2,0,1,4,2,3,5};
        metrics.setSubUUCP(10);
        metrics.setHoursPerUc(30);
        metrics.setE(ef);
        metrics.setT(tf);
        
        instance.apply(metrics);

        assertEquals(8.325999999999999, metrics.getSubUCP());
        assertEquals(20.0, metrics.getSchneiderwinters());
        assertEquals(249.77999999999997, metrics.getSubCasesHours());
        assertEquals(166.51999999999998, metrics.getSubCasesHoursSW());
    }    
    
}