KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > DefaultFitnessEvaluatorTest


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap;
11
12 import junit.framework.*;
13
14 /**
15  * Test cases for clasfs DefaultFitnessEvaluator
16  *
17  * @author Klaus Meffert
18  * @since 1.1
19  */

20 public final class DefaultFitnessEvaluatorTest
21     extends JGAPTestCase {
22
23   /** String containing the CVS revision. Read out via reflection!*/
24   private final static String JavaDoc CVS_REVISION = "$Revision: 1.6 $";
25
26   public static Test suite() {
27     TestSuite suite = new TestSuite(DefaultFitnessEvaluatorTest.class);
28     return suite;
29   }
30
31   public void testIsFitter_0() {
32     FitnessEvaluator evaluator = new DefaultFitnessEvaluator();
33     assertEquals(true, evaluator.isFitter(1, 0));
34     assertEquals(false, evaluator.isFitter(0, 1));
35   }
36
37   public void testIsFitter_1() {
38     FitnessEvaluator evaluator = new DefaultFitnessEvaluator();
39     assertEquals(true, evaluator.isFitter(12, 11));
40     assertEquals(false, evaluator.isFitter(11, 12));
41   }
42
43   public void testIsFitter_2() {
44     FitnessEvaluator evaluator = new DefaultFitnessEvaluator();
45     assertEquals(false, evaluator.isFitter( -1, 1));
46     assertEquals(true, evaluator.isFitter(1, -1));
47   }
48
49   public void testIsFitter_3() {
50     FitnessEvaluator evaluator = new DefaultFitnessEvaluator();
51     assertEquals(false, evaluator.isFitter(0, 0));
52   }
53
54   public void testIsFitter_4() {
55     FitnessEvaluator evaluator = new DefaultFitnessEvaluator();
56     assertEquals(false, evaluator.isFitter( -4, -4));
57   }
58
59   public void testIsFitter_5() {
60     FitnessEvaluator evaluator = new DefaultFitnessEvaluator();
61     assertEquals(false, evaluator.isFitter( -3, -1));
62     assertEquals(true, evaluator.isFitter( -1, -3));
63   }
64 }
65
Popular Tags