-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestIceCreamOrder4.cpp
More file actions
executable file
·104 lines (90 loc) · 2.13 KB
/
Copy pathtestIceCreamOrder4.cpp
File metadata and controls
executable file
·104 lines (90 loc) · 2.13 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// testIceCreamOrder4.cpp
// Written for CS32 S18.
#include <iostream>
#include <string>
#include "IceCreamOrder.h"
#include "PreMadeItem.h"
#include "CustomItem.h"
#include "tddFuncs.h"
using namespace std;
int main() {
cout << "Running tests from: " << __FILE__ << endl;
IceCreamOrder order1;
PreMadeItem* item1 = new PreMadeItem("Chewy Gooey", "small");
order1.addItem(item1);
CustomItem* item2 = new CustomItem("small");
item2->addTopping("mochi");
order1.addItem(item2);
string expected =
"Pre-made Size: small\n\
Pre-made Item: Chewy Gooey\n\
Price: $4.00\n\
-----\n\
Custom Size: small\n\
Toppings:\n\
mochi: 1 oz\n\
Price: $3.40\n\
-----\n\
Total: $7.40\n";
ASSERT_EQUALS(expected,order1.printBill());
delete item1;
delete item2;
IceCreamOrder order2;
CustomItem* item3 = new CustomItem("large");
item3->addTopping("almonds");
item3->addTopping("granola");
item3->addTopping("walnuts");
order2.addItem(item3);
CustomItem* item4 = new CustomItem("medium");
item4->addTopping("snickers");
item4->addTopping("snickers");
item4->addTopping("snickers");
order2.addItem(item4);
expected =
"Custom Size: large\n\
Toppings:\n\
almonds: 1 oz\n\
granola: 1 oz\n\
walnuts: 1 oz\n\
Price: $7.70\n\
-----\n\
Custom Size: medium\n\
Toppings:\n\
snickers: 3 oz\n\
Price: $6.20\n\
-----\n\
Total: $13.90\n";
ASSERT_EQUALS(expected,order2.printBill());
delete item3;
delete item4;
IceCreamOrder order3;
PreMadeItem* item5 = new PreMadeItem("Sludge Fudge", "large");
order3.addItem(item5);
PreMadeItem* item6 = new PreMadeItem("Banana Slamma", "medium");
order3.addItem(item6);
CustomItem* item7 = new CustomItem("medium");
item7->addTopping("cherries");
item7->addTopping("sprinkles");
item7->addTopping("sprinkles");
order3.addItem(item7);
expected =
"Pre-made Size: large\n\
Pre-made Item: Sludge Fudge\n\
Price: $7.50\n\
-----\n\
Pre-made Size: medium\n\
Pre-made Item: Banana Slamma\n\
Price: $6.00\n\
-----\n\
Custom Size: medium\n\
Toppings:\n\
cherries: 1 oz\n\
sprinkles: 2 oz\n\
Price: $6.20\n\
-----\n\
Total: $19.70\n";
ASSERT_EQUALS(expected,order3.printBill());
delete item5;
delete item6;
delete item7;
}