{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

TestQuiz2 - import junit.framework.TestCase A JUnit test...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import junit.framework.TestCase; i /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class TestQuiz2 extends TestCase { int [][] A1 = {{7, 9, 11}, {3, 5, 7}}; double A2[][] = {{7.2, 9.1, 11.3}, {3.8, 5.5, 7.2}}; double A3[][] = {{7.2, 9.1, 11.3}, {3.8, 5.5, 7.2}, {17.0, 52.1, 61.3}}; int [] V = {1, 2, 3}; int [] V1 = {98, 17, 32, 1, 21, 47, 84, 55, 17, 22}; // ************************************************************************* public void test_twoSmallest() { int ret[] = {0,0}; ret = Quiz2Answers.twoSmallest(V1); assertEquals("Looking for min in twosmallest: ", 1, ret[0]); assertEquals("Looking for second min in twosmallest: ", 17, ret[1]); } // ************************************************************************* public void test_makeRange() { int A = 10; int B = 20; int ret[] = new int[B-A+1]; ret = Quiz2Answers.makeRange(A,B); assertEquals("Looking for first in makeRange: ", A, ret[0]); assertEquals("Looking for last in makeRange: ", B, ret[ret.length-1]); } // ************************************************************************* public void test_rowSubtract() { int remember00 = A1[0][0]; int remembernn = A1[A1.length-1][A1[0].length-1]; int ret2[][] = new int[A1.length][A1[0].length]; ret2 = Quiz2Answers.rowSubtract(A1,V); assertEquals("Looking at 0,0 in rowSubtract: ", remember00 - V[0], ret2[0][0]); assertEquals("Looking at last,last in rowSubtract: ", remembernn - V[V.length- 1], ret2[ret2.length-1][ret2[0].length-1] );
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern