Add Pronic Number (#2867)

* Add Pronic Number

* Update directory

* Add unit tests for Pronic Number implementation

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
This commit is contained in:
Akshay Dubey
2021-12-22 01:36:16 +05:30
committed by GitHub
parent 98656cb0cd
commit 32cdf02afb
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package com.thealgorithms.maths;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class PronicNumberTest {
@Test
void testForPronicNumber() {
//given
int number = 30;
//when
boolean result = PronicNumber.isPronic(number);
//then
assertTrue(result);
}
@Test
void testForNonPronicNumber() {
//given
int number = 21;
//when
boolean result = PronicNumber.isPronic(number);
//then
assertFalse(result);
}
}