Permalink
Browse files

Small rather cosmetic changes

  • Loading branch information...
mariuszgromada committed Mar 21, 2016
1 parent c2ea41c commit eb9383c65a48fce896e6f2111c9d4b5b00aae7db
@@ -51,7 +51,6 @@
import java.util.Stack;
import org.mariuszgromada.janetutils.ArrayX;
import org.mariuszgromada.janetutils.DateTimeX;
import org.mariuszgromada.janetutils.io.FileX;
/**
* Sudoku board, with predefined Sudoku examples and possibility to load
@@ -1181,7 +1181,7 @@ public static boolean checkPuzzle(int[][] sudokuBoard) {
* is returned.
*/
public static final int randomIndex(int n) {
if (n < 1)
if (n < 0)
return ErrorCodes.SUDOKUSTORE_RANDOMINDEX_INCORRECT_PARAMETER;
return (int)Math.floor(Math.random() * n);
}
@@ -48,6 +48,7 @@
package org.mariuszgromada.math.janetsudoku.regtests;
import java.util.ArrayList;
import org.mariuszgromada.janetutils.DateTimeX;
import org.mariuszgromada.math.janetsudoku.BoardCell;
import org.mariuszgromada.math.janetsudoku.SudokuBoard;
import org.mariuszgromada.math.janetsudoku.SudokuPuzzles;
@@ -89,7 +90,7 @@ public static int start(int threadsNumber) {
int numberOfTests = ApiTests.NUMBER_OF_TESTS;
int resultsError = 0;
int resultsOk = 0;
long startTime = System.currentTimeMillis();
long startTime = DateTimeX.currentTimeMillis();
ApiTests at = new ApiTests(threadsNumber);
at.start();
boolean[] testResults = at.testsResults;
@@ -99,7 +100,7 @@ public static int start(int threadsNumber) {
else
resultsError++;
}
long endtTime = System.currentTimeMillis();
long endtTime = DateTimeX.currentTimeMillis();
double computingTime = (endtTime - startTime)/1000.0;
SudokuStore.consolePrintln("=============================================================");
SudokuStore.consolePrintln("Number of API test: " + numberOfTests + ", OK: " + resultsOk + ", ERRORS: " + resultsError + ", computing time: " + computingTime);
@@ -47,6 +47,7 @@
*/
package org.mariuszgromada.math.janetsudoku.regtests;
import org.mariuszgromada.janetutils.DateTimeX;
import org.mariuszgromada.math.janetsudoku.ErrorCodes;
import org.mariuszgromada.math.janetsudoku.SudokuPuzzles;
import org.mariuszgromada.math.janetsudoku.SudokuSolver;
@@ -88,7 +89,7 @@ public static int start(int threadsNumber) {
int numberOfTests = GeneratorTests.NUMBER_OF_TESTS;
int resultsError = 0;
int resultsOk = 0;
long startTime = System.currentTimeMillis();
long startTime = DateTimeX.currentTimeMillis();
GeneratorTests st = new GeneratorTests(threadsNumber);
st.start();
boolean[] testResults = st.testsResults;
@@ -98,7 +99,7 @@ public static int start(int threadsNumber) {
else
resultsError++;
}
long endtTime = System.currentTimeMillis();
long endtTime = DateTimeX.currentTimeMillis();
double computingTime = (endtTime - startTime)/1000.0;
SudokuStore.consolePrintln("=============================================================");
SudokuStore.consolePrintln("Number of SudokuGenerator test: " + numberOfTests + ", OK: " + resultsOk + ", ERRORS: " + resultsError + ", computing time: " + computingTime);
@@ -47,6 +47,7 @@
*/
package org.mariuszgromada.math.janetsudoku.regtests;
import org.mariuszgromada.janetutils.DateTimeX;
import org.mariuszgromada.math.janetsudoku.ErrorCodes;
import org.mariuszgromada.math.janetsudoku.SudokuBoard;
import org.mariuszgromada.math.janetsudoku.SudokuPuzzles;
@@ -88,7 +89,7 @@ public static int start(int threadsNumber) {
int numberOfTests = SolverTests.NUMBER_OF_TESTS;
int resultsError = 0;
int resultsOk = 0;
long startTime = System.currentTimeMillis();
long startTime = DateTimeX.currentTimeMillis();
SolverTests st = new SolverTests(threadsNumber);
st.start();
boolean[] testResults = st.testsResults;
@@ -98,7 +99,7 @@ public static int start(int threadsNumber) {
else
resultsError++;
}
long endtTime = System.currentTimeMillis();
long endtTime = DateTimeX.currentTimeMillis();
double computingTime = (endtTime - startTime)/1000.0;
SudokuStore.consolePrintln("=============================================================");
SudokuStore.consolePrintln("Number of SudokuSolver test: " + numberOfTests + ", OK: " + resultsOk + ", ERRORS: " + resultsError + ", computing time: " + computingTime);
@@ -46,6 +46,7 @@
* "Yes, up to isomorphism."
*/
package org.mariuszgromada.math.janetsudoku.regtests;
import org.mariuszgromada.janetutils.DateTimeX;
import org.mariuszgromada.math.janetsudoku.SudokuPuzzles;
import org.mariuszgromada.math.janetsudoku.SudokuStore;
@@ -84,7 +85,7 @@ public static int start(int threadsNumber) {
int numberOfTests = StoreTests.NUMBER_OF_TESTS;
int resultsError = 0;
int resultsOk = 0;
long startTime = System.currentTimeMillis();
long startTime = DateTimeX.currentTimeMillis();
StoreTests st = new StoreTests(threadsNumber);
st.start();
boolean[] testResults = st.testsResults;
@@ -94,7 +95,7 @@ public static int start(int threadsNumber) {
else
resultsError++;
}
long endtTime = System.currentTimeMillis();
long endtTime = DateTimeX.currentTimeMillis();
double computingTime = (endtTime - startTime)/1000.0;
SudokuStore.consolePrintln("=============================================================");
SudokuStore.consolePrintln("Number of SudokuStore test: " + numberOfTests + ", OK: " + resultsOk + ", ERRORS: " + resultsError + ", computing time: " + computingTime);

0 comments on commit eb9383c

Please sign in to comment.