MCPcopy Create free account
hub / github.com/3rdparty/libprocess / TEST_F

Function TEST_F

src/tests/io_tests.cpp:45–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43// removed on Windows.
44#ifndef __WINDOWS__
45TEST_F(IOTest, Poll)
46{
47 int pipes[2];
48 ASSERT_NE(-1, pipe(pipes));
49
50 // Test discard when polling.
51 Future<short> future = io::poll(pipes[0], io::READ);
52 EXPECT_TRUE(future.isPending());
53 future.discard();
54 AWAIT_DISCARDED(future);
55
56 // Test successful polling.
57 future = io::poll(pipes[0], io::READ);
58 EXPECT_TRUE(future.isPending());
59 ASSERT_EQ(3, write(pipes[1], "hi", 3));
60 AWAIT_EXPECT_EQ(io::READ, future);
61
62 ASSERT_SOME(os::close(pipes[0]));
63 ASSERT_SOME(os::close(pipes[1]));
64}
65#endif // __WINDOWS__
66
67

Callers 1

io_tests.cppFile · 0.70

Calls 11

closeFunction · 0.85
redirectFunction · 0.85
isPendingMethod · 0.80
isReadyMethod · 0.80
pollFunction · 0.50
writeFunction · 0.50
readFunction · 0.50
prepare_asyncFunction · 0.50
discardMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected