Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code should pass the junit test public static int[] task4(int[] seq) { int[] result = null; int size=0; int prevIndex = -1; for(int i=0;i

The code should pass the junit test public static int[] task4(int[] seq) { int[] result = null; int size=0; int prevIndex = -1; for(int i=0;i

JUNIT TEST

@Test public void test_task4_1() { int[] seq = {3, 1, 1, 1, 2, 2, 2, 2}; int[] expected = {1, 3, 3, 1, 4, 2}; assertArrayEquals(expected, Utilities.task4(seq)); }

@Test public void test_task4_2() { int[] seq = {1, 1, 1, 2, 2, 2, 2}; int[] expected = {3, 1, 4, 2}; assertArrayEquals(expected, Utilities.task4(seq)); } @Test public void test_task4_3() { int[] seq = {2, 2, 2, 2, 1, 1, 1}; int[] expected = {4, 2, 3, 1}; assertArrayEquals(expected, Utilities.task4(seq)); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions