| 248 | } |
| 249 | |
| 250 | int main() |
| 251 | { |
| 252 | std::vector<byte> fakeBytes1{ |
| 253 | 0x70_B, ESC, SOF, ESC, |
| 254 | 'H'_B, 'e'_B, 'l'_B, 'l'_B, 'o'_B, ESC, SOF, |
| 255 | 0x7_B, ESC, SOF}; |
| 256 | |
| 257 | // #A Simulate the first network stream |
| 258 | auto stream1 = sender(std::move(fakeBytes1)); |
| 259 | |
| 260 | // #B Create the Parse coroutine and store the handle in p |
| 261 | auto p = Parse(); |
| 262 | |
| 263 | ProcessStream(stream1, p); // #C Process the bytes |
| 264 | |
| 265 | // #D Simulate the reopening of the network stream |
| 266 | std::vector<byte> fakeBytes2{ |
| 267 | 'W'_B, 'o'_B, 'r'_B, 'l'_B, 'd'_B, ESC, SOF, 0x99_B}; |
| 268 | |
| 269 | // #E Simulate a second network stream |
| 270 | auto stream2 = sender(std::move(fakeBytes2)); |
| 271 | |
| 272 | // #F We still use the former p and feed it with new bytes |
| 273 | ProcessStream(stream2, p); |
| 274 | |
| 275 | } |
nothing calls this directly
no test coverage detected