diff --git a/src/main/java/src/TasksFrame.java b/src/main/java/src/TasksFrame.java index e9973d0..2170fda 100644 --- a/src/main/java/src/TasksFrame.java +++ b/src/main/java/src/TasksFrame.java @@ -79,6 +79,12 @@ public class TasksFrame extends JFrame { } + public int calcMod(int n, int x) + { + int rest = n % x; + return rest; + } + private void setupEulerschePhiFunk() { JPanel jPanel = setupPanel("Eulersche Phi Funktion"); diff --git a/src/test/java/src/TasksFrameTest.java b/src/test/java/src/TasksFrameTest.java index d31ce6b..00e5c38 100644 --- a/src/test/java/src/TasksFrameTest.java +++ b/src/test/java/src/TasksFrameTest.java @@ -91,6 +91,18 @@ class TasksFrameTest { } + @Test + void setupMod() + { + TasksFrame tasksFrame = new TasksFrame(); + int p1= tasksFrame.calcMod(5,3); + assertEquals(2,p1); + int p2 = tasksFrame.calcMod(4,2); + assertEquals(0,p2); + int p3= tasksFrame.calcMod(10,3); + assertEquals(1,p3); + } + }