summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxJava/tests
diff options
context:
space:
mode:
authorHaidong Ji2018-09-28 17:56:55 -0500
committerHaidong Ji2018-09-28 17:56:55 -0500
commite5b7ce55049265c4391d910ed44c9a89b5131266 (patch)
treefc41f1324181ee39f4455076593dc67f177f9ece /AlgoDesignAndTechniqueEdxJava/tests
parentb78f460310c816381319b36e24ef138cde93b3fb (diff)
Max num of prize places done!
Eclipse (I'm currently using Photon) "the type integer is invisible" error is really annoying. I adjusted Java compiler to version 10, which appeared to fix, but it came back. (10 is the version from command line "java --version") Hopefully a restart will take care of it for good.
Diffstat (limited to 'AlgoDesignAndTechniqueEdxJava/tests')
-rw-r--r--AlgoDesignAndTechniqueEdxJava/tests/DifferentSummandsTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxJava/tests/DifferentSummandsTest.java b/AlgoDesignAndTechniqueEdxJava/tests/DifferentSummandsTest.java
new file mode 100644
index 0000000..5732642
--- /dev/null
+++ b/AlgoDesignAndTechniqueEdxJava/tests/DifferentSummandsTest.java
@@ -0,0 +1,37 @@
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+class DifferentSummandsTest {
+
+ @Test
+ void test() {
+ int n = 6;
+ assertEquals(3, DifferentSummands.getOptimalSummands(n).size());
+ }
+
+ @Test
+ void test1() {
+ int n = 8;
+ assertEquals(3, DifferentSummands.getOptimalSummands(n).size());
+ }
+
+ @Test
+ void test2() {
+ int n = 2;
+ assertEquals(1, DifferentSummands.getOptimalSummands(n).size());
+ }
+
+ @Test
+ void test3() {
+ int n = 4;
+ assertEquals(2, DifferentSummands.getOptimalSummands(n).size());
+ }
+
+ @Test
+ void test4() {
+ int n = 4;
+ assertEquals(3, DifferentSummands.getOptimalSummands(n).get(1).intValue());
+ }
+
+}