Gwendal in main : add test on futur constraints and enhance input symbol method (#1)
Co-authored-by: ROGER <gwendal.roger@etu.univ-lyon1.fr> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,17 +1,35 @@
|
||||
/*
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package sudoku;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class AppTest {
|
||||
@Test
|
||||
public void testExample() {
|
||||
System.out.println("DOING TEST");
|
||||
assertEquals(2 + 2, 4);
|
||||
System.out.println("DONE TEST");
|
||||
// Simulate user input
|
||||
String simulatedInput = "1\n1\n2\n3\n4\n5\n6\n7\n8\n9\n";
|
||||
System.setIn(new ByteArrayInputStream(simulatedInput.getBytes()));
|
||||
|
||||
// Create a new Sudoku
|
||||
Sudoku sudoku = new Sudoku(9);
|
||||
sudoku.getGrille().askSetSymbolesPossibles();
|
||||
|
||||
// Verify the symbols
|
||||
ArrayList<Symbole> expectedSymbols = new ArrayList<>(Arrays.asList(
|
||||
Symbole.of(1),
|
||||
Symbole.of(2),
|
||||
Symbole.of(3),
|
||||
Symbole.of(4),
|
||||
Symbole.of(5),
|
||||
Symbole.of(6),
|
||||
Symbole.of(7),
|
||||
Symbole.of(8),
|
||||
Symbole.of(9)));
|
||||
assertEquals(expectedSymbols, sudoku.getGrille().getSymbolesPossibles());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user