mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
24
tests/common/utils/TestFdWrapper.cc
Normal file
24
tests/common/utils/TestFdWrapper.cc
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common/utils/FdWrapper.h"
|
||||
|
||||
namespace hf3fs::test {
|
||||
namespace {
|
||||
|
||||
TEST(TestFdWrapper, Normal) {
|
||||
int p[2];
|
||||
ASSERT_EQ(::pipe(p), 0);
|
||||
|
||||
FdWrapper fd;
|
||||
ASSERT_EQ(fd, -1);
|
||||
|
||||
fd = p[0];
|
||||
fd = FdWrapper{p[1]}; // p[0] is closed.
|
||||
ASSERT_EQ(fd, p[1]);
|
||||
|
||||
fd = FdWrapper{}; // p[1] is closed.
|
||||
ASSERT_EQ(fd, -1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace hf3fs::test
|
||||
Reference in New Issue
Block a user