25 fifo =
new Fifo((
size_t) 100);
30 for(
int i=0; i<9; i++){
31 inbuff[i] = (char) i+97;
36 EXPECT_EQ((
size_t) 0, fifo->read(outbuff, (
size_t) 10,
false));
40 written_bytes = fifo->write(inbuff, (
size_t) 21);
41 read_bytes = fifo->read(outbuff, (
size_t) 21);
42 EXPECT_STREQ(inbuff, outbuff);
43 EXPECT_EQ(written_bytes, read_bytes);
46 EXPECT_EQ((
size_t) 0, fifo->read(outbuff, (
size_t) 21,
false));
49 for(
int i = 0; i < 10; i++){
50 written_bytes = fifo->write(inbuff, (
size_t) 11);
51 read_bytes = fifo->read(outbuff, (
size_t) 11);
52 EXPECT_STREQ(inbuff, outbuff);
53 EXPECT_EQ(written_bytes, read_bytes);
61 fifo =
new Fifo((
size_t) 2);
62 char buff[8] =
"message";
65 EXPECT_EQ(fifo->write(buff, (
size_t) 8), (
size_t) 0);
70 char message[8] =
"message";
73 fifo =
new Fifo((
size_t) 10);
74 std::thread sender(&
Fifo::write, fifo, message, size);
75 std::thread receiver(&
Fifo::read, fifo, output, size,
true);
78 EXPECT_STREQ(message, output);