Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

@Test @Order(5) @Graded(description=testIsValidSubsetIndexP, marks=2.5) public void testIsValidSubsetIndexP() { assertFalse(aP.isValidSubsetIndex(-1)); assertFalse(aP.isValidSubsetIndex((int)(Math.random()*-1000))); assertFalse(aP.isValidSubsetIndex(4)); assertFalse(aP.isValidSubsetIndex(4 + (int)(Math.random()*1000))); for(int i=0; i < 4; i++) { assertTrue(aP.isValidSubsetIndex(i)); } currentMethodName =

@Test @Order(5) @Graded(description="testIsValidSubsetIndexP", marks=2.5) public void testIsValidSubsetIndexP() { assertFalse(aP.isValidSubsetIndex(-1)); assertFalse(aP.isValidSubsetIndex((int)(Math.random()*-1000))); assertFalse(aP.isValidSubsetIndex(4)); assertFalse(aP.isValidSubsetIndex(4 + (int)(Math.random()*1000))); for(int i=0; i < 4; i++) { assertTrue(aP.isValidSubsetIndex(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(6) @Graded(description="testIsValidSubsetIndexCR", marks=2.5) public void testIsValidSubsetIndexCR() { testIsValidSubsetIndexP(); assertFalse(aCR.isValidSubsetIndex(-1)); assertFalse(aCR.isValidSubsetIndex((int)(Math.random()*-1000))); assertFalse(aCR.isValidSubsetIndex(5)); assertFalse(aCR.isValidSubsetIndex(5 + (int)(Math.random()*1000))); for(int i=0; i < 5; i++) { assertTrue(aCR.isValidSubsetIndex(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }

@Test @Order(7) @Graded(description="testIsValidSubsetIndexD", marks=2.5) public void testIsValidSubsetIndexD() { testIsValidSubsetIndexCR(); assertFalse(aD.isValidSubsetIndex(-1)); assertFalse(aD.isValidSubsetIndex((int)(Math.random()*-1000))); assertFalse(aD.isValidSubsetIndex(11)); assertFalse(aD.isValidSubsetIndex(11 + (int)(Math.random()*1000))); for(int i=0; i < 11; i++) { assertTrue(aD.isValidSubsetIndex(i)); } assertFalse(aEmpty.isValidSubsetIndex(-1)); assertFalse(aEmpty.isValidSubsetIndex(0)); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(8) @Graded(description="testIsValidSubsetIndexHD", marks=2.5) public void testIsValidSubsetIndexHD() { testIsValidSubsetIndexD(); assertFalse(aHD.isValidSubsetIndex(-1)); assertFalse(aHD.isValidSubsetIndex((int)(Math.random()*-1000))); assertFalse(aHD.isValidSubsetIndex(10)); assertFalse(aHD.isValidSubsetIndex(10 + (int)(Math.random()*1000))); for(int i=0; i < 10; i++) { assertTrue(aHD.isValidSubsetIndex(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(9) @Graded(description="testItemExistsAtP", marks=2.5) public void testItemExistsAtP() { assertFalse(aP.itemExistsAt(-1, 0)); assertFalse(aP.itemExistsAt(0, -1)); for(int i=0; i < 3; i++) { assertTrue(aP.itemExistsAt(i, 0)); assertTrue(aP.itemExistsAt(i, 1)); assertTrue(aP.itemExistsAt(i, 2)); } assertFalse(aP.itemExistsAt(4, 0)); assertFalse(aP.itemExistsAt(0, 3)); assertFalse(aP.itemExistsAt(0, 3 + (int)(Math.random()*1000))); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(10) @Graded(description="testItemExistsAtCR", marks=2.5) public void testItemExistsAtCR() { testItemExistsAtP(); assertFalse(aCR.itemExistsAt(-1, 0)); assertFalse(aCR.itemExistsAt(0, -1)); for(int i=0; i < 4; i++) { assertTrue(aCR.itemExistsAt(i, 0)); assertTrue(aCR.itemExistsAt(i, 1)); assertTrue(aCR.itemExistsAt(i, 2)); } assertFalse(aCR.itemExistsAt(5, 0)); assertFalse(aCR.itemExistsAt(0, 4)); assertFalse(aCR.itemExistsAt(0, 4 + (int)(Math.random()*1000))); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(11) @Graded(description="testItemExistsAtD", marks=2.5) public void testItemExistsAtD() { testItemExistsAtCR(); assertFalse(aD.itemExistsAt(-1, 0)); assertFalse(aD.itemExistsAt(0, -1)); for(int i=0; i < 11; i++) { for(int k=0; k < aD.data[i].length; k++) { assertTrue(aD.itemExistsAt(i, k)); } for(int k=aD.data[i].length; k < 20; k++) { assertFalse(aD.itemExistsAt(i, k)); } } assertFalse(aD.itemExistsAt(11, 0)); assertFalse(aEmpty.itemExistsAt(10, 0)); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }

@Test @Order(12) @Graded(description="testItemExistsAtHD", marks=2.5) public void testItemExistsAtHD() { testItemExistsAtD(); assertFalse(aHD.itemExistsAt(-1, 0)); assertFalse(aHD.itemExistsAt(0, -1)); for(int i=0; i < 10; i++) { for(int k=0; k < aHD.data[i].length; k++) { assertTrue(aHD.itemExistsAt(i, k)); } for(int k=aHD.data[i].length; k < 20; k++) { assertFalse(aHD.itemExistsAt(i, k)); } } assertFalse(aHD.itemExistsAt(10, 0)); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }

https://www.chegg.com/homework-help/questions-and-answers/functions-must-completed-using-instance-variable-array-data--s-array-arrays-integers-examp-q70141722?trackid=1QlJJkVA

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_2

Step: 3

blur-text-image_3

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

Establish identity. + cos 0 + sin 0 sec e + tan e 1 + cos 0 sin 0

Answered: 1 week ago