From 48ecf24862fc9d9314e81d877dd3fcc3b7f9c894 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 2 Feb 2018 10:52:30 +0100 Subject: Add matrix shape test Signed-off-by: pacien --- .../java/fr/umlv/java/wallj/board/MatrixTest.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/java/fr/umlv/java/wallj/board/MatrixTest.java (limited to 'src/test/java/fr') diff --git a/src/test/java/fr/umlv/java/wallj/board/MatrixTest.java b/src/test/java/fr/umlv/java/wallj/board/MatrixTest.java new file mode 100644 index 0000000..4510b12 --- /dev/null +++ b/src/test/java/fr/umlv/java/wallj/board/MatrixTest.java @@ -0,0 +1,27 @@ +package fr.umlv.java.wallj.board; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * @author Pacien TRAN-GIRARD + */ +final class MatrixTest { + + @Test + void testMatrixSize() { + Integer[][] ma = {{0}, {0}}; + Assertions.assertEquals(Matrix.getWidth(ma), 1); + Assertions.assertEquals(Matrix.getHeight(ma), 2); + + List> ml = Arrays.asList(Collections.singletonList(0), Collections.singletonList(0)); + Assertions.assertEquals(Matrix.getWidth(ml), 1); + Assertions.assertEquals(Matrix.getHeight(ml), 2); + Assertions.assertTrue(Matrix.isShapeValid(ml)); + } + +} -- cgit v1.2.3