From 5002e2da07308f9a227c8d1435fb394ae52d8494 Mon Sep 17 00:00:00 2001 From: Ngo Duc Huy <17020798@vnu.edu.vn> Date: Wed, 2 Oct 2019 01:11:06 +0700 Subject: [PATCH] Create CombinationTest.java --- CombinationTest.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CombinationTest.java diff --git a/CombinationTest.java b/CombinationTest.java new file mode 100644 index 0000000..200da3b --- /dev/null +++ b/CombinationTest.java @@ -0,0 +1,36 @@ +package testing; + +import org.junit.Assert; +import org.junit.Test; + +public class CombinationTest { + @Test + public void test1() { + long com1 = Combination.ncr(2, -1); + Assert.assertEquals(-1, com1); + } + + @Test + public void test2() { + long com2 = Combination.ncr(-2, 1); + Assert.assertEquals(-1, com2); + } + + @Test + public void test3() { + long com3 = Combination.ncr(2, 3); + Assert.assertEquals(-1, com3); + } + + @Test + public void test4() { + long com4 = Combination.ncr(6, 4); + Assert.assertEquals(15, com4); + } + + @Test + public void test5() { + long com5 = Combination.ncr(6, 0); + Assert.assertEquals(1, com5); + } +}