Пример #1
3
 @Test
 public void subtractHSS() {
   assertEquals(
       scoreDefinitionHSS.createScore(21, 280, -8000),
       scoreDefinitionHSS
           .createScore(20, -20, -4000)
           .subtract(scoreDefinitionHSS.createScore(-1, -300, 4000)));
 }
Пример #2
1
 @Test
 public void feasibleHSS() {
   assertScoreNotFeasible(scoreDefinitionHSS.createScore(-5, -300, -4000));
   assertScoreFeasible(
       scoreDefinitionHSS.createScore(0, -300, -4000),
       scoreDefinitionHSS.createScore(2, -300, -4000));
 }
Пример #3
1
 @Test
 public void powerHSS() {
   assertEquals(
       scoreDefinitionHSS.createScore(9, 16, 25),
       scoreDefinitionHSS.createScore(3, -4, 5).power(2.0));
   assertEquals(
       scoreDefinitionHSS.createScore(3, 4, 5),
       scoreDefinitionHSS.createScore(9, 16, 25).power(0.5));
 }
Пример #4
1
 @Test
 public void multiplyHSS() {
   assertEquals(
       scoreDefinitionHSS.createScore(6, -6, 6),
       scoreDefinitionHSS.createScore(5, -5, 5).multiply(1.2));
   assertEquals(
       scoreDefinitionHSS.createScore(1, -2, 1),
       scoreDefinitionHSS.createScore(1, -1, 1).multiply(1.2));
   assertEquals(
       scoreDefinitionHSS.createScore(4, -5, 4),
       scoreDefinitionHSS.createScore(4, -4, 4).multiply(1.2));
 }
Пример #5
0
 @Test
 public void addHSS() {
   assertEquals(
       scoreDefinitionHSS.createScore(19, -320, 0),
       scoreDefinitionHSS
           .createScore(20, -20, -4000)
           .add(scoreDefinitionHSS.createScore(-1, -300, 4000)));
 }
Пример #6
0
 @Test
 public void multiplyHHSSS() {
   assertEquals(
       scoreDefinitionHHSSS.createScore(6, -6, 6, 0, 0),
       scoreDefinitionHHSSS.createScore(5, -5, 5, 0, 0).multiply(1.2));
   assertEquals(
       scoreDefinitionHHSSS.createScore(1, -2, 1, 0, 0),
       scoreDefinitionHHSSS.createScore(1, -1, 1, 0, 0).multiply(1.2));
   assertEquals(
       scoreDefinitionHHSSS.createScore(4, -5, 4, 0, 0),
       scoreDefinitionHHSSS.createScore(4, -4, 4, 0, 0).multiply(1.2));
 }
Пример #7
0
 @Test
 public void serializeAndDeserialize() {
   BendableScore input = scoreDefinitionHSS.createScore(-5, -300, -4000);
   SerializationTestUtils.serializeAndDeserializeWithAll(
       input,
       new SerializationTestUtils.OutputAsserter<BendableScore>() {
         public void assertOutput(BendableScore output) {
           assertEquals(1, output.getHardLevelCount());
           assertEquals(-5, output.getHardScore(0));
           assertEquals(2, output.getSoftLevelCount());
           assertEquals(-300, output.getSoftScore(0));
           assertEquals(-4000, output.getSoftScore(1));
         }
       });
 }
Пример #8
0
 @Test
 public void divideHSS() {
   assertEquals(
       scoreDefinitionHSS.createScore(5, -5, 5),
       scoreDefinitionHSS.createScore(25, -25, 25).divide(5.0));
   assertEquals(
       scoreDefinitionHSS.createScore(4, -5, 4),
       scoreDefinitionHSS.createScore(21, -21, 21).divide(5.0));
   assertEquals(
       scoreDefinitionHSS.createScore(4, -5, 4),
       scoreDefinitionHSS.createScore(24, -24, 24).divide(5.0));
 }
Пример #9
0
 @Test(expected = IllegalArgumentException.class)
 public void parseScoreIllegalArgument() {
   scoreDefinitionHSS.parseScore("-147");
 }
Пример #10
0
 @Test
 public void parseScore() {
   assertEquals(
       scoreDefinitionHSS.createScore(-147, -258, -369),
       scoreDefinitionHSS.parseScore("-147/-258/-369"));
 }
Пример #11
0
 @Test
 public void compareToHHSSS() {
   assertScoreCompareToOrder(
       scoreDefinitionHHSSS.createScore(-20, Integer.MIN_VALUE, Integer.MIN_VALUE, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, Integer.MIN_VALUE, -20, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, Integer.MIN_VALUE, 1, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -300, -4000, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -300, -300, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -300, -20, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -300, 300, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -20, -300, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -20, 0, 0, 0),
       scoreDefinitionHHSSS.createScore(-20, -20, 1, 0, 0),
       scoreDefinitionHHSSS.createScore(-1, -300, -4000, 0, 0),
       scoreDefinitionHHSSS.createScore(-1, -300, -20, 0, 0),
       scoreDefinitionHHSSS.createScore(-1, -20, -300, 0, 0),
       scoreDefinitionHHSSS.createScore(1, Integer.MIN_VALUE, -20, 0, 0),
       scoreDefinitionHHSSS.createScore(1, -20, Integer.MIN_VALUE, 0, 0));
 }
Пример #12
0
 @Test
 public void equalsAndHashCodeHHSSS() {
   assertScoresEqualsAndHashCode(
       scoreDefinitionHHSSS.createScore(-10, -20, -30, 0, 0),
       scoreDefinitionHHSSS.createScore(-10, -20, -30, 0, 0));
 }