<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


/**
 * implement method:
 * public static int[] Lab03.addPolynomials(int[] a,int b[])
 * which returns sum of polynomials (a+b)
 */
public class Lab03AddPolynomialsTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testSimple() {
		assertArrayEquals(
				new int[]{1,4,7}, 
				run(new int[]{1,2,3}, new int[]{0,2,4})
		);
	}

	@Test
	public void testEmpty() {
		assertArrayEquals(
				new int[]{1,2,3}, 
				run(new int[]{1,2,3}, new int[]{})
		);
		assertArrayEquals(
				new int[]{1,2,3}, 
				run(new int[]{}, new int[]{1,2,3})
		);
	}

	@Test
	public void testZeros() {
		assertArrayEquals(
				new int[]{0}, 
				run(new int[]{0,0,0}, new int[]{0,0,0,0})
		);
		assertArrayEquals(
				new int[]{0}, 
				run(new int[]{0,0,0,1}, new int[]{0,0,0,-1})
		);
	}
	
	
	int[] run(int[] a, int[] b) {
		return Lab03.addPolynomials(a, b);
	}

}
</pre></body></html>