-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestIceCreamOrder2.cpp
More file actions
executable file
·68 lines (54 loc) · 1.23 KB
/
Copy pathtestIceCreamOrder2.cpp
File metadata and controls
executable file
·68 lines (54 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// testIceCreamOrder2.cpp
// Written for CS32 S18.
#include <iostream>
#include <string>
#include "IceCreamOrder.h"
#include "CustomItem.h"
#include "tddFuncs.h"
using namespace std;
int main() {
cout << "Running tests from: " << __FILE__ << endl;
IceCreamOrder order1;
CustomItem* item1 = new CustomItem("small");
item1->addTopping("mochi");
order1.addItem(item1);
string expected =
"Custom Size: small\n\
Toppings:\n\
mochi: 1 oz\n\
Price: $3.40\n\
-----\n\
Total: $3.40\n";
ASSERT_EQUALS(expected,order1.printBill());
delete item1;
IceCreamOrder order2;
CustomItem* item2 = new CustomItem("medium");
item2->addTopping("gummi bears");
item2->addTopping("gummi bears");
order2.addItem(item2);
expected =
"Custom Size: medium\n\
Toppings:\n\
gummi bears: 2 oz\n\
Price: $5.80\n\
-----\n\
Total: $5.80\n";
ASSERT_EQUALS(expected,order2.printBill());
delete item2;
IceCreamOrder order3;
CustomItem* item3 = new CustomItem("large");
item3->addTopping("oreos");
item3->addTopping("peanuts");
item3->addTopping("peanuts");
order3.addItem(item3);
expected =
"Custom Size: large\n\
Toppings:\n\
oreos: 1 oz\n\
peanuts: 2 oz\n\
Price: $7.70\n\
-----\n\
Total: $7.70\n";
ASSERT_EQUALS(expected,order3.printBill());
delete item3;
}