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, 22.06.2019 15:30
In a compound condition, both conditions on either side of the logical operator and must be true for the overall condition to be true. a: true b: false
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 23.06.2019 04:20
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy.a. a fire occurs on the premises, and the building isbadly damaged.b. a burglar steals some money and securities from anunlocked safe.c. a business computer is damaged by vandals whobreak into the shop after business hours.d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm.til
Answers: 2
question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
You know the right answer?
Write a unit test for addInventory(). Call redSweater. addInventory() with parameter sweaterShipment...
Questions
question
Biology, 23.11.2020 17:20
question
Computers and Technology, 23.11.2020 17:20
question
Mathematics, 23.11.2020 17:20
Questions on the website: 13722363