subject

Write a unit test for addInventory(). Call redSweater. addInventory() with parameter sweaterShipment. Print the shown error if the subsequent quantity is incorrect. Sample output for failed unit test given initial quantity is 10 and sweaterShipment is 50:
Beginning tests.
UNIT TEST FAILED: addInventory()
Tests complete.
Note: UNIT TEST FAILED is preceded by 3 spaces.

#include
using namespace std;

class InventoryTag {
public:
InventoryTag();
int getQuantityRemaining() const;
void addInventory(int numItems);

private:
int quantityRemaining;
};

InventoryTag::InventoryTag() {
quantityRemaining = 0;
}

int InventoryTag::getQuantityRemaining( ) const {
return quantityRemaining;
}

void InventoryTag::addInventory(int numItems) {
if (numItems > 10) {
quantityRemaining = quantityRemaining + numItems;
}
}

int main() {
InventoryTag redSweater;
int sweaterShipment = 0;
int sweaterInventoryBefore = 0;

sweaterInventoryBefore = redSweater. getQuantityRemaining();
sweaterShipment = 25;

cout << "Beginning tests." << endl;

// FIXME add unit test for addInventory

/* Your solution goes here */

cout << "Tests complete." << endl;

return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 10:00
What is estimated time of arrival (eta)? a device that measures the acceleration (the rate of change of velocity) of an item and is used to track truck speeds or taxi cab speeds a gps technology adventure game that posts the longitude and latitude location for an item on the internet for users to find a north/south measurement of position the time of day of an expected arrival at a certain destination and is typically used for navigation applications
Answers: 3
question
Computers and Technology, 23.06.2019 12:30
What is the difference between the internet and the world wide web?
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
You know the right answer?
Write a unit test for addInventory(). Call redSweater. addInventory() with parameter sweaterShipment...
Questions
question
Mathematics, 17.03.2020 05:37
Questions on the website: 13722367