66public class SumOfMultiplesTest {
77
88 @ Test
9- public void testSumOfMultiplesOf3and5UpToOne () {
9+ public void testNoMultiplesWithinLimit () {
1010
1111 int [] set = {
1212 3 ,
@@ -19,7 +19,7 @@ public void testSumOfMultiplesOf3and5UpToOne() {
1919
2020 @ Ignore ("Remove to run test" )
2121 @ Test
22- public void testSumOfMultiplesOf3and5UpToFour () {
22+ public void testOneFactorHasMultiplesWithinLimit () {
2323
2424 int [] set = {
2525 3 ,
@@ -32,7 +32,7 @@ public void testSumOfMultiplesOf3and5UpToFour() {
3232
3333 @ Ignore ("Remove to run test" )
3434 @ Test
35- public void testSumOfMultiplesOf3aUpToSeven () {
35+ public void testMoreThanOneMultipleWithinLimit () {
3636
3737 int [] set = {
3838 3
@@ -44,7 +44,7 @@ public void testSumOfMultiplesOf3aUpToSeven() {
4444
4545 @ Ignore ("Remove to run test" )
4646 @ Test
47- public void testSumOfMultiplesOf3and5UpToTen () {
47+ public void testMoreThanOneFactorWithMultiplesWithinLimit () {
4848
4949 int [] set = {
5050 3 ,
@@ -57,7 +57,7 @@ public void testSumOfMultiplesOf3and5UpToTen() {
5757
5858 @ Ignore ("Remove to run test" )
5959 @ Test
60- public void testSumOfMultiplesOf3and5UpToOneHundred () {
60+ public void testEachMultipleIsOnlyCountedOnce () {
6161
6262 int [] set = {
6363 3 ,
@@ -70,7 +70,7 @@ public void testSumOfMultiplesOf3and5UpToOneHundred() {
7070
7171 @ Ignore ("Remove to run test" )
7272 @ Test
73- public void testSumOfMultiplesOf3and5UpToOneThousand () {
73+ public void testAMuchLargerLimit () {
7474
7575 int [] set = {
7676 3 ,
@@ -83,7 +83,7 @@ public void testSumOfMultiplesOf3and5UpToOneThousand() {
8383
8484 @ Ignore ("Remove to run test" )
8585 @ Test
86- public void testSumOfMultiplesOf7and13and17UpToTwenty () {
86+ public void testThreeFactors () {
8787
8888 int [] set = {
8989 7 ,
@@ -97,7 +97,7 @@ public void testSumOfMultiplesOf7and13and17UpToTwenty() {
9797
9898 @ Ignore ("Remove to run test" )
9999 @ Test
100- public void testSumOfMultiplesOf4and6UpToFifteen () {
100+ public void testFactorsNotRelativelyPrime () {
101101
102102 int [] set = {
103103 4 ,
@@ -110,7 +110,7 @@ public void testSumOfMultiplesOf4and6UpToFifteen() {
110110
111111 @ Ignore ("Remove to run test" )
112112 @ Test
113- public void testSumOfMultiplesOf5and6and8UpToOneHundredFifty () {
113+ public void testSomePairsOfFactorsRelativelyPrimeAndSomeNot () {
114114
115115 int [] set = {
116116 5 ,
@@ -124,7 +124,7 @@ public void testSumOfMultiplesOf5and6and8UpToOneHundredFifty() {
124124
125125 @ Ignore ("Remove to run test" )
126126 @ Test
127- public void testSumOfMultiplesOf5and25UpToFiftyOne () {
127+ public void testOneFactorIsAMultipleOfAnother () {
128128
129129 int [] set = {
130130 5 ,
@@ -137,7 +137,7 @@ public void testSumOfMultiplesOf5and25UpToFiftyOne() {
137137
138138 @ Ignore ("Remove to run test" )
139139 @ Test
140- public void testSumOfMultiplesOf43and47UpToTenThousand () {
140+ public void testMuchLargerFactors () {
141141
142142 int [] set = {
143143 43 ,
@@ -150,7 +150,7 @@ public void testSumOfMultiplesOf43and47UpToTenThousand() {
150150
151151 @ Ignore ("Remove to run test" )
152152 @ Test
153- public void testSumOfMultiplesOfOneUpToOneHundred () {
153+ public void testAllNumbersAreMultiplesOf1 () {
154154
155155 int [] set = {
156156 1
@@ -162,11 +162,53 @@ public void testSumOfMultiplesOfOneUpToOneHundred() {
162162
163163 @ Ignore ("Remove to run test" )
164164 @ Test
165- public void testSumOfMultiplesOfNoneUpToTenThousand () {
165+ public void testNoFactorsMeanAnEmptySum () {
166166
167167 int [] set = {};
168168 int output = new SumOfMultiples (10000 , set ).getSum ();
169169 assertEquals (0 , output );
170170
171171 }
172+
173+ @ Ignore ("Remove to run test" )
174+ @ Test
175+ public void testSumOfMultiplesOfZeroIsZero () {
176+
177+ int [] set = {
178+ 0
179+ };
180+ int output = new SumOfMultiples (1 , set ).getSum ();
181+ assertEquals (0 , output );
182+
183+ }
184+
185+ @ Ignore ("Remove to run test" )
186+ @ Test
187+ public void testFactorZeroDoesNotAffectTheSumOfMultiplesOfOtherFactors () {
188+
189+ int [] set = {
190+ 3 ,
191+ 0
192+ };
193+ int output = new SumOfMultiples (4 , set ).getSum ();
194+ assertEquals (3 , output );
195+
196+ }
197+
198+ @ Ignore ("Remove to run test" )
199+ @ Test
200+ public void testSolutionsUsingIncludeExcludeMustExtendToCardinalityGreater3 () {
201+
202+ int [] set = {
203+ 2 ,
204+ 3 ,
205+ 5 ,
206+ 7 ,
207+ 11
208+ };
209+ int output = new SumOfMultiples (10000 , set ).getSum ();
210+ assertEquals (39614537 , output );
211+
212+ }
213+
172214}
0 commit comments