View Javadoc
1   /*
2    * #%L
3    * IsisFish
4    * 
5    * $Id: ContinuousDomainTest.java 4301 2015-09-29 16:46:43Z echatellier $
6    * $HeadURL: https://svn.codelutin.com/isis-fish/tags/isis-fish-4.4.0.2/src/test/java/fr/ifremer/isisfish/simulator/sensitivity/domain/ContinuousDomainTest.java $
7    * %%
8    * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric
9    * %%
10   * This program is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as
12   * published by the Free Software Foundation, either version 3 of the 
13   * License, or (at your option) any later version.
14   * 
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Public 
21   * License along with this program.  If not, see
22   * <http://www.gnu.org/licenses/gpl-3.0.html>.
23   * #L%
24   */
25  package fr.ifremer.isisfish.simulator.sensitivity.domain;
26  
27  import org.junit.Assert;
28  import org.junit.Test;
29  
30  import fr.ifremer.isisfish.simulator.sensitivity.Distribution;
31  
32  public class ContinuousDomainTest {
33  
34      /**
35       * Test jdistlib pour verifier que les parametres sont bien compris en compte.
36       * 
37       * Ici : valeurs positives non gérées correctement.
38       */
39      @Test
40      public void testJDistLib1() {
41          
42          ContinuousDomain d = new ContinuousDomain(Distribution.QUNIFPC);
43          d.getDistributionParameters().put("reference", 0.83);
44          d.getDistributionParameters().put("coefficient", 0.5);
45          
46          Assert.assertEquals(0.581, (Double)d.getValueForIdentifier(0.2), 0.001);
47          Assert.assertEquals(1.162, (Double)d.getValueForIdentifier(0.9), 0.001);
48      }
49      
50      /**
51       * Test jdistlib pour verifier que les parametres sont bien compris en compte.
52       * 
53       * Ici : valeurs négatives non gérées correctement (min &gt; max).
54       */
55      @Test
56      public void testJDistLib2() {
57          
58          ContinuousDomain d = new ContinuousDomain(Distribution.QUNIFPC);
59          d.getDistributionParameters().put("reference", -0.83);
60          d.getDistributionParameters().put("coefficient", 0.5);
61          
62          Assert.assertEquals(-1.079, (Double)d.getValueForIdentifier(0.2), 0.001);
63          Assert.assertEquals(-0.498, (Double)d.getValueForIdentifier(0.9), 0.001);
64      }
65  }