Skip to content

Commit 6ed31cc

Browse files
committed
Add tests for CoinChange
1 parent 5b3e02b commit 6ed31cc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.packt.datastructuresandalg.lesson4.activity.coinchange;
2+
3+
import com.packt.datastructuresandalg.lesson4.activity.coinchange.solution.CoinChange;
4+
import junit.framework.TestCase;
5+
6+
import java.util.Arrays;
7+
8+
public class CoinChangeTest extends TestCase {
9+
CoinChange change = new CoinChange();
10+
11+
public void test1() {
12+
int[] coins = {1, 2, 3};
13+
assertTrue(change.ways(4, coins) == 4);
14+
}
15+
16+
public void test2() {
17+
int[] coins = {2, 3, 5, 6};
18+
assertTrue(change.ways(10, coins) == 5);
19+
}
20+
21+
public void test3() {
22+
int[] coins = {1, 5, 10, 25};
23+
assertTrue(change.ways(63, coins) == 73);
24+
}
25+
}

0 commit comments

Comments
 (0)