From cec39970dfbb827a656e233f1906ed118def17f8 Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Fri, 9 Feb 2024 22:59:44 +0100 Subject: [PATCH] Test: Write positive numbers test for factorial calculation --- src/test/java/CalculationsTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/CalculationsTest.java b/src/test/java/CalculationsTest.java index 52c5e17..6586f94 100644 --- a/src/test/java/CalculationsTest.java +++ b/src/test/java/CalculationsTest.java @@ -18,6 +18,19 @@ public class CalculationsTest { // Test with a large number assertEquals(1000000, calc.calculateSquare(1000)); + } + + @Test + public void testCalculateFactorial() { + Calculations fact = new Calculations(); + + // Test with positive numbers + assertEquals(1, fact.calculateFactorial(0)); + assertEquals(1, fact.calculateFactorial(1)); + assertEquals(2, fact.calculateFactorial(2)); + assertEquals(6, fact.calculateFactorial(3)); + assertEquals(24, fact.calculateFactorial(4)); + assertEquals(120, fact.calculateFactorial(5)); } }