import static org.junit.Assert.assertEquals; import org.junit.Test; import components.sequence.Sequence; import components.sequence.Sequence1L; /** * Sample JUnit test fixture for SequenceSmooth. * * @author Put your name here * */ public final class SequenceSmoothTest { /** * Constructs and returns a sequence of the integers provided as arguments. * * @param args * 0 or more integer arguments * @return the sequence of the given arguments * @ensures createFromArgs= [the sequence of integers in args] */ private Sequence createFromArgs(Integer... args) { Sequence s = new Sequence1L(); for (Integer x : args) { s.add(s.length(), x); } return s; } /** * Test smooth with s1 = <2, 4, 6> and s2 = <-5, 12>. */ @Test public void test1() { /* * Set up variables and call method under test */ Sequence seq1 = this.createFromArgs(2, 4, 6); Sequence expectedSeq1 = this.createFromArgs(2, 4, 6); Sequence seq2 = this.createFromArgs(-5, 12); Sequence expectedSeq2 = this.createFromArgs(3, 5); SequenceSmooth.smooth(seq1, seq2); /* * Assert that values of variables match expectations */ assertEquals(expectedSeq1, seq1); assertEquals(expectedSeq2, seq2); } /** * Test smooth with s1 = <7> and s2 = <13, 17, 11>. */ @Test public void test2() { /* * Set up variables and call method under test */ Sequence seq1 = this.createFromArgs(7); Sequence expectedSeq1 = this.createFromArgs(7); Sequence seq2 = this.createFromArgs(13, 17, 11); Sequence expectedSeq2 = this.createFromArgs(); SequenceSmooth.smooth(seq1, seq2); /* * Assert that values of variables match expectations */ assertEquals(expectedSeq1, seq1); assertEquals(expectedSeq2, seq2); } }