Skip to content
Snippets Groups Projects
Commit 11461bc1 authored by Maxime Tissot's avatar Maxime Tissot
Browse files

Tests for field

parent 0b0f41aa
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,18 @@ public class Field { ...@@ -9,7 +9,18 @@ public class Field {
private int[][] startField = new int[9][9]; private int[][] startField = new int[9][9];
private int[][] solutionField = new int[9][9]; private int[][] solutionField = new int[9][9];
private int cellsToFill;
public int getCellsToFill() {
int cellsToFill = 0;
for (int row = 0; row < 9; row++){
for (int col = 0; col < 9; col++){
if (startField[row][col] == -1){
cellsToFill++;
}
}
}
return cellsToFill;
}
public void field(){ public void field(){
int[] sampleStart = int[] sampleStart =
...@@ -33,17 +44,6 @@ public class Field { ...@@ -33,17 +44,6 @@ public class Field {
6, 8, 9, 4, 1, 3, 7, 2, 5, 6, 8, 9, 4, 1, 3, 7, 2, 5,
1, 2, 4, 9, 5, 7, 6, 3, 8}; 1, 2, 4, 9, 5, 7, 6, 3, 8};
cellsToFill = 0;
int iterator = 0;
for (int row = 0; row < 9; row++){
for (int col = 0; col < 9; col++){
startField[row][col] = sampleStart[iterator];
solutionField[row][col] = sampleSolution[iterator];
iterator++;
if (startField[row][col] == -1){
cellsToFill++;
}
}
}
} }
} }
...@@ -4,6 +4,9 @@ import java.io.IOException; ...@@ -4,6 +4,9 @@ import java.io.IOException;
public class RunTest { public class RunTest {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
Tests tests = new Tests();
System.out.println("Test geht los\n"); System.out.println("Test geht los\n");
tests.testFieldCreator();
} }
} }
package hsrt.VSundSOA.backendapi;
import hsrt.VSundSOA.backendapi.fieldCreation.FieldCreation;
import java.util.ArrayList;
public class Tests {
private FieldCreation fieldCreator = new FieldCreation();
public void testFieldCreator(){
ArrayList<int[][]> newField = fieldCreator.getNewField();
System.out.println();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment