Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • ImprovedMouseInteraction
  • correction_video
  • going_further
  • main
  • ModifGUI
  • final2023
  • template
7 results

Target

Select target project
  • s20026898/tp-6
  • boukenze.b/jeu-de-la-vie-tp-3
  • b22015696/game-of-life-template
  • s23026062/sahin-game-of-life-template
  • m22023183/game-of-life-MALEK
  • z23012739/game-of-life-template
  • p23021107/poussardin-malo-game-of-life-template
  • o21225801/game-of-life-template
  • alaboure/game-fo-life-template
  • t22007439/game-of-life-toullec
  • b23021750/game-of-life
  • c22029830/game-of-life-template-rafi
  • b23025683/game-of-life-template-tp-6
  • gnaves/game-of-life-template
  • a22025223/game-of-life-template-cristel
  • f22024692/game-of-life-template-paolo-mathis-erwan
  • t21233923/game-fo-life-template
  • h21231335/game-fo-life-template
  • l22023519/game-of-life-template-salma
  • p23020787/game-of-life-template
  • b21232450/game-of-life-template
  • s22031458/game-of-life
  • n21223697/tp-4-ngom
  • a22027291/game-of-life-of-salim
  • k22029508/tp-4
  • s19033421/game-of-life-template
  • b21229750/jeu-de-la-vie-tp-3
  • saddem.r/game-of-life-template
  • l3_s3_infoamu/s3/programmation-2/game-fo-life-template
29 results
Select Git revision
  • ImprovedMouseInteraction
  • correction_video
  • going_further
  • main
  • ModifGUI
  • final2023
  • template
7 results
Show changes
package view;
import datastruct.Coordinate;
import matrix.Coordinate;
import javafx.scene.input.MouseEvent;
class WaitingMouseListener implements MouseListener {
......
package datastruct;
package matrix;
import org.junit.jupiter.api.Test;
......@@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.*;
class ConstantMatrixInitializerTest {
@Test
public void testMatrixInitializationWithConstantValue() {
Matrix<String> matrix = new Matrix<>(3, 3, new ConstantMatrixInitializer<>("X"));
ListMatrix<String> matrix = new ListMatrix<>(3, 3, new ConstantMatrixInitializer<>("X"));
// Test that all cells have the constant value.
for (int x = 0; x < 3; x++) {
......@@ -19,7 +19,7 @@ class ConstantMatrixInitializerTest {
@Test
public void testMatrixInitializationWithConstantValue2() {
Matrix<Integer> matrix = new Matrix<>(3, 5, new ConstantMatrixInitializer<>(12));
ListMatrix<Integer> matrix = new ListMatrix<>(3, 5, new ConstantMatrixInitializer<>(12));
// Test that all cells have the constant value.
for (int x = 0; x < 3; x++) {
......
package datastruct;
package matrix;
import org.junit.jupiter.api.Test;
......
package datastruct;
package matrix;
import org.junit.jupiter.api.Test;
......
package datastruct;
package matrix;
import org.junit.jupiter.api.Test;
......@@ -6,14 +6,14 @@ import java.util.Iterator;
import static org.junit.jupiter.api.Assertions.*;
class MatrixTest {
class ListMatrixTest {
private final MatrixInitializer<Integer> sumInitializer =
coord -> coord.x() + coord.y();
@Test
public void testMatrixCreationWithInitializer() {
Matrix<Integer> matrix = new Matrix<>(3, 4, sumInitializer);
ListMatrix<Integer> matrix = new ListMatrix<>(3, 4, sumInitializer);
assertEquals(3, matrix.width());
assertEquals(4, matrix.height());
assertEquals(4, matrix.get(2, 2));
......@@ -24,7 +24,7 @@ class MatrixTest {
@Test
public void testMatrixCreationWithInitialValue() {
Matrix<String> matrix = new Matrix<>(2, 2, "Foo");
ListMatrix<String> matrix = new ListMatrix<>(2, 2, "Foo");
assertEquals(2, matrix.width());
assertEquals(2, matrix.height());
assertEquals("Foo", matrix.get(1, 1)); // Test a specific cell value.
......@@ -32,7 +32,7 @@ class MatrixTest {
@Test
public void testMatrixSetAndGet() {
Matrix<Integer> matrix = new Matrix<>(3, 3, 0);
ListMatrix<Integer> matrix = new ListMatrix<>(3, 3, 0);
matrix.set(1, 1,42);
assertEquals(42, matrix.get(1, 1));
matrix.set(0, 2,10);
......@@ -43,7 +43,7 @@ class MatrixTest {
@Test
public void testMatrixWidthAndHeight() {
Matrix<String> matrix = new Matrix<>(4, 2, "A");
ListMatrix<String> matrix = new ListMatrix<>(4, 2, "A");
assertEquals(4, matrix.width());
assertEquals(2, matrix.height());
matrix.set(3, 1,"B");
......@@ -53,7 +53,7 @@ class MatrixTest {
@Test
public void testMatrixIterator() {
Matrix<Integer> matrix = new Matrix<>(2, 2, sumInitializer);
ListMatrix<Integer> matrix = new ListMatrix<>(2, 2, sumInitializer);
Iterator<Integer> iterator = matrix.iterator();
assertTrue(iterator.hasNext());
assertEquals(0, iterator.next());
......@@ -68,7 +68,7 @@ class MatrixTest {
@Test
public void testMatrixCoordinates() {
Matrix<Integer> matrix = new Matrix<>(2, 2, 0);
ListMatrix<Integer> matrix = new ListMatrix<>(2, 2, 0);
Iterable<Coordinate> coordinates = matrix.coordinates();
int count = 0;
for (Coordinate coord : coordinates) {
......@@ -77,12 +77,24 @@ class MatrixTest {
assertEquals(4, count);
}
@Test
public void testMatrixLens() {
Matrix<Integer> matrix = new Matrix<>(2, 2, 0);
Lens<Integer> lens = matrix.at(1, 1);
assertEquals(0, lens.get());
lens.set(42);
assertEquals(42, matrix.get(1, 1));
public void testSubMatrix() {
Matrix<Integer> matrix = new ListMatrix<>(5, 5, 0);
for (int x = 0; x < 5; x++) {
for (int y = 0; y < 5; y++) {
matrix.set(x,y,x + y * 5);
}
}
Matrix<Integer> sub = matrix.subMatrix(Coordinate.of(2,1),2,3);
assertEquals(2, sub.width());
assertEquals(3, sub.height());
for (int x = 2; x < 4; x++) {
for (int y = 1; y < 4; y++) {
assertEquals(x + y * 5, sub.get(x-2,y-1));
}
}
}
}
package model;
import datastruct.Coordinate;
import matrix.Coordinate;
import javafx.scene.paint.Color;
import model.automata.GameOfLifeAutomaton;
import static model.automata.GameOfLifeState.*;
......
package model;
import controller.Simulation;
import datastruct.Coordinate;
import matrix.Coordinate;
import model.automata.GameOfLifeAutomaton;
import model.automata.GameOfLifeState;
import org.junit.jupiter.api.BeforeEach;
......