Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help debugging to get test cases to run. TEST CODE / / Try to access out of bounds. string caughtError = ;
Need help debugging to get test cases to run. TEST CODE Try to access out of bounds.
string caughtError ;
try
item sigetFifthElement;
catch std::outofrange&
caughtError "caught";
checkTesttestNum correct, "caught", caughtError;
delete si;
SinglyLinkedList ss new SinglyLinkedList;
sspushBackMulti Pass";
sspushBackLelu Dallas";
sspushBackBIG BADA BOOM";
sspushBackBruce Willis";
sspushBackFried Chicken";
sspushBackEEEAAAAAAAeeeaaaaaEEeeAAAEEaaaaAA;
checkTesttestNum correct, "Fried Chicken", ssgetFifthElement;
delete ss;
return testNum correct;
This helps with testing, do not modify.
bool testInsertNewFifthElement
int testNum ;
int correct ;
cout testInsertNewFifthElement Tests endl;
SinglyLinkedList si new SinglyLinkedList;
for int i ; i ; i
sipushBacki;
Test just to make sure the data went in the list.
checkTesttestNum correct, sigetStringFromList;
Test inserting an item
siinsertNewFifthElement;
checkTesttestNum correct, sigetStringFromList;
delete si;
si new SinglyLinkedList;
for int i ; i ; i
sipushBacki;
Test just to make sure the data went in the list.
checkTesttestNum correct, sigetStringFromList;
Test inserting an item
siinsertNewFifthElement;
checkTesttestNum correct, sigetStringFromList;
delete si;
si new SinglyLinkedList;
for int i ; i ; i
sipushBacki;
Test just to make sure the data went in the list.
checkTesttestNum correct, sigetStringFromList;
Test inserting an item
siinsertNewFifthElement;
checkTesttestNum correct, sigetStringFromList;
checkTesttestNum correct, sigetLast;
delete si;
Now test inserting an invalid option
si new SinglyLinkedList;
for int i ; i ; i
sipushBacki;
siinsertNewFifthElement;
Test just to make sure the data didn't go in at all and didn't crash.
checkTesttestNum correct, sigetStringFromList;
delete si;
return testNum correct;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started