Ad
  • Default User Avatar

    Please add theese to fixed tests:

    public static void main(String[] args) {
    	int[][] battleField2 = { { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
    	                         { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
    	                         { 1, 1, 1, 0, 1, 1, 0, 0, 0, 1 },
    	                         { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    	                         { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
    	                         { 1, 0, 0, 1, 0, 0, 0, 0, 0, 1 },
    	                         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } };
    	System.out.println(BattleField.fieldValidator(battleField2) == false);
    	int[][] battleField3 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 1, 1, 0, 1, 0, 0, 1, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 1, 1, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 1, 1, 0, 0, 0, 1},
    	                         {0, 0, 1, 0, 0, 0, 0, 1, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField3) == false);
    	int[][] battleField4 = { {0, 1, 1, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 1, 1, 1, 1, 0, 1, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField4) == false);
    	int[][] battleField5 = { {0, 1, 1, 1, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
    	                         {0, 0, 0, 1, 1, 0, 0, 0, 0, 1},
    	                         {0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
    	                         {0, 1, 0, 0, 0, 0, 0, 0, 0, 1},
    	                         {0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 1, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField5) == false);
    	int[][] battleField6 = { {0, 0, 0, 0, 0, 0, 1, 1, 1, 0},
    	                         {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 1, 1, 0, 1, 0},
    	                         {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 1, 1},
    	                         {0, 0, 0, 0, 0, 0, 1, 0, 1, 0},
    	                         {0, 0, 1, 0, 0, 0, 1, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0} };
    	System.out.println(BattleField.fieldValidator(battleField6) == false);
    	int[][] battleField7 = { {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
    	                         {1, 0, 1, 0, 1, 1, 0, 0, 0, 1},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 1, 1, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 1, 1, 0, 1, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 1, 1, 0, 0, 0, 1, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField7) == false);
    	int[][] battleField8 = { {1, 0, 0, 0, 0, 1, 1, 0, 0, 0},
    	                         {1, 0, 1, 0, 0, 0, 0, 0, 1, 0},
    	                         {1, 0, 1, 0, 1, 1, 1, 0, 1, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
    	                         {0, 0, 0, 1, 0, 0, 0, 0, 1, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField8) == false);
    	int[][] battleField9 = { {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                         {1, 1, 1, 0, 1, 0, 0, 0, 0, 0},
    	                         {0, 0, 0, 0, 0, 0, 0, 1, 1, 1},
    	                         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
    	                         {1, 0, 0, 0, 0, 1, 0, 1, 1, 0},
    	                         {1, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField9));
    	int[][] battleField10 = { {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 0, 0, 0, 1, 0, 0, 0, 0},
    	                          {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 1, 1, 1, 0, 1, 1, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 1, 1, 1, 0, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 1, 1, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField10) == false);
    	int[][] battleField11 = { {0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
    	                          {0, 1, 1, 0, 0, 1, 0, 0, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 0, 1, 0, 1, 1, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 1, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 1, 0, 0, 1, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    	                          {1, 0, 0, 0, 0, 0, 1, 0, 0, 0},
    	                          {1, 0, 0, 1, 1, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField11) == false);
    	int[][] battleField12 = { {1, 0, 0, 0, 0, 1, 0, 0, 0, 1},
    	                          {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 0, 1, 0, 1, 0, 1, 0, 0},
    	                          {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
    	                          {0, 0, 1, 0, 1, 0, 0, 1, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 1, 0, 0, 1, 0, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 0, 1, 0, 0, 0, 0, 0, 1} };
    	System.out.println(BattleField.fieldValidator(battleField12) == false);
    	int[][] battleField13 = { {1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    	                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
    	System.out.println(BattleField.fieldValidator(battleField13) == false);
    }
    

    I accidentally posted invalid solution that pass random tests once but didn't pass random test on the next attempt. If you will accept my suggestion than tests for this awesome kata will be more comprehensive. Thank you!