diff --git a/Time.java b/Time.java index 8b6053a..ab8e7e7 100644 --- a/Time.java +++ b/Time.java @@ -2,7 +2,7 @@ public class Time { public static boolean timeCheck(String time) { - String regex = "^(?:[01]\\d|2[0-3]):[0-5]\\d$"; + String regex = "([01]\\d|2[0-3]):([0-5]\\d)"; boolean formatRichtig = false; if (time == null) { diff --git a/VectorTest.java b/VectorTest.java index f4992a9..f0a6549 100644 --- a/VectorTest.java +++ b/VectorTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.*; public class VectorTest { - @Test + @Test void testScalarMultiplicationVariants() { int[] v1 = { 1, 2, 3 }; Vector.scalarMultiplication(v1, 2); @@ -20,18 +20,6 @@ public class VectorTest { assertArrayEquals(new int[] { 0, 0, 0 }, v3); } - @Test - void testVectorProduct2D() { - int[] vector1 = { 3, 4 }; - int[] vector2 = { 5, 6 }; - // Für 2D Kreuzprodukt wird der Skalarwert (Z-Komponente des 3D-Kreuzprodukts) - // verwendet - // 3*6 - 4*5 = 18 - 20 = -2 - // Erwartete Ausgabe: -2 - System.out.print("Erwartete Ausgabe: -2\nTatsächliche Ausgabe: "); - Vector.vectorProduct(vector1, vector2); - } - @Test void testVectorProduct2DVariants() { int ergebnis1 = -2; @@ -43,18 +31,6 @@ public class VectorTest { } - @Test - void testVectorProduct3D() { - int[] vector1 = { 1, 2, 3 }; - int[] vector2 = { 4, 5, 6 }; - // Kreuzprodukt: - // x = 2*6 - 3*5 = 12 - 15 = -3 - // y = 3*4 - 1*6 = 12 - 6 = 6 - // z = 1*5 - 2*4 = 5 - 8 = -3 - System.out.print("Erwartete Ausgabe: [-3, 6, -3]\nTatsächliche Ausgabe: "); - Vector.vectorProduct(vector1, vector2); - } - @Test void testVectorProduct3DVariants() { int[] ergebnis1 = { -3, 6, -3 }; @@ -73,15 +49,6 @@ public class VectorTest { } @Test - void testVectorLength() { - int[] vector = { 3, 4 }; - double length = Vector.vectorLength(vector); - assertEquals(5.0, length, 0.001); - - int[] vector3D = { 1, 2, 2 }; - assertEquals(3.0, Vector.vectorLength(vector3D), 0.001); - } - @Test void testVectorLengthVariants() { assertEquals(5.0, Vector.vectorLength(new int[] { 3, 4 }), 0.001); assertEquals(3.0, Vector.vectorLength(new int[] { 1, 2, 2 }), 0.001); @@ -89,21 +56,6 @@ public class VectorTest { } @Test - void testMatrixMultiplicationValidMatrix() { - int[][] matrix = { - { 1, 2, 3 }, - { 4, 5, 6 }, - { 7, 8, 9 } - }; - int scalar = 2; - int[][] expected = { - { 2, 4, 6 }, - { 8, 10, 12 }, - { 14, 16, 18 } - }; - assertArrayEquals(expected, Vector.matrixMultiplication(matrix, scalar)); - } - @Test void testMatrixMultiplicationVariants() { int[][] matrix = { { 1, 2, 3 }, @@ -130,21 +82,6 @@ public class VectorTest { assertArrayEquals(expectedZero, Vector.matrixMultiplication(zeroMatrix, 0)); } - - @Test - void testMatrixMultiplicationInvalidMatrix() { - int[][] invalidMatrix = { - { 1, 2 }, - { 3, 4 } - }; - assertNull(Vector.matrixMultiplication(invalidMatrix, 3)); - } - - - - - - @Test void testMatrixMultiplicationInvalidCases() { int[][] nonSquare = {