Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help on Java @Test public void testSumOfDistinctCubes() { // Explicit test cases String b1 = [4, 3]; assertEquals(b1, P2J6.sumOfDistinctCubes(91).toString()); String b2 = [5]; assertEquals(b2,
Need help on Java
@Test public void testSumOfDistinctCubes() { | |
// Explicit test cases | |
String b1 = "[4, 3]"; | |
assertEquals(b1, P2J6.sumOfDistinctCubes(91).toString()); | |
String b2 = "[5]"; | |
assertEquals(b2, P2J6.sumOfDistinctCubes(125).toString()); | |
String b3 = "[4, 3, 2]"; | |
assertEquals(b3, P2J6.sumOfDistinctCubes(99).toString()); | |
String b4 = "[7, 2]"; | |
assertEquals(b4, P2J6.sumOfDistinctCubes(351).toString()); | |
String b5 = "[11, 4]"; | |
assertEquals(b5, P2J6.sumOfDistinctCubes(1395).toString()); | |
String b6 = "[]"; | |
assertEquals(b6, P2J6.sumOfDistinctCubes(2020).toString()); | |
// Pseudorandom fuzz tester | |
CRC32 check = new CRC32(); | |
Random rng = new Random(SEED); | |
int c = 1, step = 2, next = 10; | |
while(c > 0) { | |
List | |
check.update(result.toString().getBytes()); | |
c += rng.nextInt(step) + 1; | |
if(c > next) { | |
next = 2 * next; | |
step = 2 * step; | |
} | |
} | |
assertEquals(4219145223L, check.getValue()); | |
} |
Make sure can pass the tester, thanks. I will vote up.
public static ListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started