Exemplo n.º 1
0
 @Test
 public void testIndexLimit() {
   for (Category cat : Category.values()) {
     sc.fillScore(cat);
   }
   sc.addScore(63);
   assertEquals(ScoreCard.MAX_INDEX, sc.getIndex());
   assertEquals("111111111111111111111", Utils.maskToBinaryString(sc.getIndex()));
   sc = new ScoreCard();
 }
Exemplo n.º 2
0
  @Test
  public void testScoreCardGeneration() {
    ScoreCard sc;
    boolean[][] variations;
    boolean[] usedIndexes = new boolean[ScoreCard.MAX_INDEX];

    for (int filled = 14; filled >= 0; filled--) {
      variations = Utils.allWaysToPut(filled, 15);

      for (boolean[] way : variations) {
        sc = new ScoreCard();
        int i = 0;
        for (Category cat : Category.values()) {
          if (way[i++]) sc.fillScore(cat);
        }
        assertFalse(usedIndexes[sc.getIndex()]);
        usedIndexes[sc.getIndex()] = true;
      }
    }
  }