Skip to content

Commit 7680754

Browse files
committed
Fix
1 parent 475dc86 commit 7680754

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/test/java/com/thealgorithms/dynamicprogramming/RodCuttingTest.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ void testCutRodLength1() {
2020
int[] prices = {1}; // Price for piece of length 1
2121
int length = 1;
2222
int expectedValue = 1;
23-
assertEquals(expectedValue, RodCutting.cutRod(prices, length),
24-
"The maximum obtainable value for a rod of length 1 should be 1.");
23+
assertEquals(expectedValue, RodCutting.cutRod(prices, length), "The maximum obtainable value for a rod of length 1 should be 1.");
2524
}
2625

2726
/**
@@ -33,8 +32,7 @@ void testCutRodLength2() {
3332
int[] prices = {1, 5}; // Prices for lengths 1 and 2
3433
int length = 2;
3534
int expectedValue = 5; // Best value is to cut it into a single piece of length 2
36-
assertEquals(expectedValue, RodCutting.cutRod(prices, length),
37-
"The maximum obtainable value for a rod of length 2 should be 5.");
35+
assertEquals(expectedValue, RodCutting.cutRod(prices, length), "The maximum obtainable value for a rod of length 2 should be 5.");
3836
}
3937

4038
/**
@@ -46,8 +44,7 @@ void testCutRodLength3() {
4644
int[] prices = {1, 5, 8}; // Prices for lengths 1, 2, and 3
4745
int length = 3;
4846
int expectedValue = 8; // Best value is to cut it into a single piece of length 3
49-
assertEquals(expectedValue, RodCutting.cutRod(prices, length),
50-
"The maximum obtainable value for a rod of length 3 should be 8.");
47+
assertEquals(expectedValue, RodCutting.cutRod(prices, length), "The maximum obtainable value for a rod of length 3 should be 8.");
5148
}
5249

5350
/**
@@ -59,8 +56,7 @@ void testCutRodLength4() {
5956
int[] prices = {1, 5, 8, 9}; // Prices for lengths 1, 2, 3, and 4
6057
int length = 4;
6158
int expectedValue = 10; // Best value is to cut it into two pieces of length 2
62-
assertEquals(expectedValue, RodCutting.cutRod(prices, length),
63-
"The maximum obtainable value for a rod of length 4 should be 10.");
59+
assertEquals(expectedValue, RodCutting.cutRod(prices, length), "The maximum obtainable value for a rod of length 4 should be 10.");
6460
}
6561

6662
/**
@@ -72,8 +68,7 @@ void testCutRodLength5() {
7268
int[] prices = {1, 5, 8, 9, 10}; // Prices for lengths 1, 2, 3, 4, and 5
7369
int length = 5;
7470
int expectedValue = 13; // Best value is to cut it into pieces of lengths 2 and 3
75-
assertEquals(expectedValue, RodCutting.cutRod(prices, length),
76-
"The maximum obtainable value for a rod of length 5 should be 13.");
71+
assertEquals(expectedValue, RodCutting.cutRod(prices, length), "The maximum obtainable value for a rod of length 5 should be 13.");
7772
}
7873

7974
/**
@@ -85,8 +80,7 @@ void testCutRodLength0() {
8580
int[] prices = {1, 5, 8, 9, 10}; // Prices are irrelevant for length 0
8681
int length = 0;
8782
int expectedValue = 0; // No value obtainable from a rod of length 0
88-
assertEquals(expectedValue, RodCutting.cutRod(prices, length),
89-
"The maximum obtainable value for a rod of length 0 should be 0.");
83+
assertEquals(expectedValue, RodCutting.cutRod(prices, length), "The maximum obtainable value for a rod of length 0 should be 0.");
9084
}
9185

9286
/**
@@ -97,7 +91,6 @@ void testCutRodLength0() {
9791
void testCutRodEmptyPrices() {
9892
int[] prices = {};
9993
int length = 5;
100-
assertThrows(IllegalArgumentException.class, () -> RodCutting.cutRod(prices, length),
101-
"An empty prices array should throw an IllegalArgumentException.");
94+
assertThrows(IllegalArgumentException.class, () -> RodCutting.cutRod(prices, length), "An empty prices array should throw an IllegalArgumentException.");
10295
}
10396
}

0 commit comments

Comments
 (0)