コード例 #1
0
 @Test
 public void bogusAddDownRegulation() {
   RegulationAccumulator rc = new RegulationAccumulator(1.0, -2.0);
   rc.addDownRegulation(3.0);
   assertEquals("correct up-regulation", 1.0, rc.getUpRegulationCapacity(), 1e-6);
   assertEquals("correct down-regulation", -2.0, rc.getDownRegulationCapacity(), 1e-6);
 }
コード例 #2
0
 @Test
 public void testRegulationCapacity() {
   // normal creation
   RegulationAccumulator rc = new RegulationAccumulator(1.0, -2.0);
   assertEquals("correct up-regulation", 1.0, rc.getUpRegulationCapacity(), 1e-6);
   assertEquals("correct down-regulation", -2.0, rc.getDownRegulationCapacity(), 1e-6);
 }
コード例 #3
0
 @Test
 public void testAdd() {
   RegulationAccumulator rc = new RegulationAccumulator(1.0, -2.0);
   RegulationAccumulator rc1 = new RegulationAccumulator(2.0, -3.0);
   rc.add(rc1);
   assertEquals("correct up-regulation", 3.0, rc.getUpRegulationCapacity(), 1e-6);
   assertEquals("correct down-regulation", -5.0, rc.getDownRegulationCapacity(), 1e-6);
 }
コード例 #4
0
 @Test
 public void testSetDown() {
   RegulationAccumulator rc = new RegulationAccumulator(1.0, -2.0);
   rc.setDownRegulationCapacity(-2.5);
   assertEquals("successful set", -2.5, rc.getDownRegulationCapacity(), 1e-6);
   rc.setDownRegulationCapacity(3.0);
   assertEquals("no change", -2.5, rc.getDownRegulationCapacity(), 1e-6);
 }
コード例 #5
0
 @Test
 public void bogusRegulationCapacity() {
   RegulationAccumulator rc = new RegulationAccumulator(1.0, 2.0);
   assertEquals("correct up-regulation", 1.0, rc.getUpRegulationCapacity(), 1e-6);
   assertEquals("default down-regulation", 0.0, rc.getDownRegulationCapacity(), 1e-6);
   RegulationAccumulator rc1 = new RegulationAccumulator(-1.0, -2.0);
   assertEquals("default up-regulation", 0.0, rc1.getUpRegulationCapacity(), 1e-6);
   assertEquals("correct down-regulation", -2.0, rc1.getDownRegulationCapacity(), 1e-6);
 }