forked from huangrt01/TCP-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
byte_stream_construction.cc
40 lines (34 loc) · 1.08 KB
/
byte_stream_construction.cc
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
#include "byte_stream.hh"
#include "byte_stream_test_harness.hh"
#include <exception>
#include <iostream>
using namespace std;
int main() {
try {
{
ByteStreamTestHarness test{"construction", 15};
test.execute(InputEnded{false});
test.execute(BufferEmpty{true});
test.execute(Eof{false});
test.execute(BytesRead{0});
test.execute(BytesWritten{0});
test.execute(RemainingCapacity{15});
test.execute(BufferSize{0});
}
{
ByteStreamTestHarness test{"construction-end", 15};
test.execute(EndInput{});
test.execute(InputEnded{true});
test.execute(BufferEmpty{true});
test.execute(Eof{true});
test.execute(BytesRead{0});
test.execute(BytesWritten{0});
test.execute(RemainingCapacity{15});
test.execute(BufferSize{0});
}
} catch (const exception &e) {
cerr << "Exception: " << e.what() << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}