Debian Codegraph @

t/auto_corpus/calculator.feature_corpus

raw
1 Feature: Basic Calculator Functions
2 In order to check I've written the Calculator class correctly
3 As a developer I want to check some basic operations
4 So that I can have confidence in my Calculator class.
5
6 Background:
7 Given a usable "Calculator" class
8
9 Scenario: First Key Press on the Display
10 Given a new Calculator object
11 And having pressed 1
12 Then the display should show 1
13
14 Scenario: Several Key Presses on the Display
15 Given a new Calculator object
16 And having pressed 1 and 2 and 3 and . and 5 and 0
17 Then the display should show 123.50
18
19 Scenario: Pressing Clear Wipes the Display
20 Given a new Calculator object
21 And having pressed 1 and 2 and 3
22 And having pressed C
23 Then the display should show 0
24
25 Scenario: Add as you go
26 Given a new Calculator object
27 And having pressed 1 and 2 and 3 and + and 4 and 5 and 6 and +
28 Then the display should show 579
29
30 Scenario: Basic arithmetic
31 Given a new Calculator object
32 And having keyed <first>
33 And having keyed <operator>
34 And having keyed <second>
35 And having pressed =
36 Then the display should show <result>
37 Examples:
38 | first | operator | second | result |
39 | 5.0 | + | 5.0 | 10 |
40 | 6 | / | 3 | 2 |
41 | 10 | * | 7.550 | 75.5 |
42 | 3 | - | 10 | -7 |
43
44 Scenario: Separation of calculations
45 Given a new Calculator object
46 And having successfully performed the following calculations
47 | first | operator | second | result |
48 | 0.5 | + | 0.1 | 0.6 |
49 | 0.01 | / | 0.01 | 1 |
50 | 10 | * | 1 | 10 |
51 And having pressed 3
52 Then the display should show 3
53
54 Scenario: Ticker Tape
55 Given a new Calculator object
56 And having entered the following sequence
57 """
58 1 + 2 + 3 + 4 + 5 + 6 -
59 100
60 * 13 \=\=\= + 2 =
61 """
62 Then the display should show -1025
63 ----------DIVIDER----------
64 ---
65 line: 1
66 name: Basic Calculator Functions
67 satisfaction:
68 - In order to check I've written the Calculator class correctly
69 - As a developer I want to check some basic operations
70 - So that I can have confidence in my Calculator class.
71 scenarios:
72 -
73 background: 0
74 line: 9
75 name: First Key Press on the Display
76 steps:
77 -
78 data: ~
79 line: 10
80 text: a new Calculator object
81 verb: Given
82 verb_original: Given
83 -
84 data: ~
85 line: 11
86 text: having pressed 1
87 verb: Given
88 verb_original: And
89 -
90 data: ~
91 line: 12
92 text: the display should show 1
93 verb: Then
94 verb_original: Then
95 -
96 background: 0
97
98 line: 14
99 name: Several Key Presses on the Display
100 steps:
101 -
102 data: ~
103 line: 15
104 text: a new Calculator object
105 verb: Given
106 verb_original: Given
107 -
108 data: ~
109 line: 16
110 text: having pressed 1 and 2 and 3 and . and 5 and 0
111 verb: Given
112 verb_original: And
113 -
114 data: ~
115 line: 17
116 text: the display should show 123.50
117 verb: Then
118 verb_original: Then
119 -
120 background: 0
121
122 line: 19
123 name: Pressing Clear Wipes the Display
124 steps:
125 -
126 data: ~
127 line: 20
128 text: a new Calculator object
129 verb: Given
130 verb_original: Given
131 -
132 data: ~
133 line: 21
134 text: having pressed 1 and 2 and 3
135 verb: Given
136 verb_original: And
137 -
138 data: ~
139 line: 22
140 text: having pressed C
141 verb: Given
142 verb_original: And
143 -
144 data: ~
145 line: 23
146 text: the display should show 0
147 verb: Then
148 verb_original: Then
149 -
150 background: 0
151
152 line: 25
153 name: Add as you go
154 steps:
155 -
156 data: ~
157 line: 26
158 text: a new Calculator object
159 verb: Given
160 verb_original: Given
161 -
162 data: ~
163 line: 27
164 text: having pressed 1 and 2 and 3 and + and 4 and 5 and 6 and +
165 verb: Given
166 verb_original: And
167 -
168 data: ~
169 line: 28
170 text: the display should show 579
171 verb: Then
172 verb_original: Then
173 -
174 background: 0
175 line: 30
176 name: Basic arithmetic
177 steps:
178 -
179 data: ~
180 line: 31
181 text: a new Calculator object
182 verb: Given
183 verb_original: Given
184 -
185 data: ~
186 line: 32
187 text: having keyed <first>
188 verb: Given
189 verb_original: And
190 -
191 data: ~
192 line: 33
193 text: having keyed <operator>
194 verb: Given
195 verb_original: And
196 -
197 data: ~
198 line: 34
199 text: having keyed <second>
200 verb: Given
201 verb_original: And
202 -
203 data: ~
204 line: 35
205 text: having pressed =
206 verb: Given
207 verb_original: And
208 -
209 data: ~
210 line: 36
211 text: the display should show <result>
212 verb: Then
213 verb_original: Then
214 -
215 background: 0
216
217 line: 44
218 name: Separation of calculations
219 steps:
220 -
221 data: ~
222 line: 45
223 text: a new Calculator object
224 verb: Given
225 verb_original: Given
226 -
227 data:
228 -
229 first: '0.5'
230 operator: +
231 result: '0.6'
232 second: '0.1'
233 -
234 first: '0.01'
235 operator: /
236 result: 1
237 second: '0.01'
238 -
239 first: 10
240 operator: "*"
241 result: 10
242 second: 1
243 line: 46
244 text: having successfully performed the following calculations
245 verb: Given
246 verb_original: And
247 -
248 data: ~
249 line: 51
250 text: having pressed 3
251 verb: Given
252 verb_original: And
253 -
254 data: ~
255 line: 52
256 text: the display should show 3
257 verb: Then
258 verb_original: Then
259 -
260 background: 0
261
262 line: 54
263 name: Ticker Tape
264 steps:
265 -
266 data: ~
267 line: 55
268 text: a new Calculator object
269 verb: Given
270 verb_original: Given
271 -
272 data: "1 + 2 + 3 + 4 + 5 + 6 -\n100\n* 13 === + 2 =\n"
273 line: 56
274 text: having entered the following sequence
275 verb: Given
276 verb_original: And
277 -
278 data: ~
279 line: 62
280 text: the display should show -1025
281 verb: Then
282 verb_original: Then