38 #include <gtest/gtest.h> 49 TEST(AtomicioTest, AtomicReadBigBuffer)
54 std::string file_contents =
"This is just some test data to ensure that we" 55 " can read correctly from a file.";
57 fputs(file_contents.c_str(), file);
67 for (
unsigned int i = 0;
i < size;
i++) {
76 TEST(AtomicioTest, AtomicReadSmallBuffer)
81 std::string file_contents =
"This is just some test data to ensure that we" 82 " can read correctly from a file.";
84 fputs(file_contents.c_str(), file);
94 for (
unsigned int i = 0;
i < size;
i++) {
102 TEST(AtomicioTest, AtomicWrite)
107 std::string file_contents =
"This is just some test data to ensure that we" 108 " can write correctly to a file.";
111 file_contents.c_str(),
112 file_contents.size());
119 for (
unsigned int i = 0; (c = fgetc(file)) != EOF;
i++) {
120 EXPECT_EQ(file_contents[
i], (
unsigned char)c);
ssize_t atomic_read(int fd, void *s, size_t n)
TEST(AtomicioTest, AtomicReadBigBuffer)
ssize_t atomic_write(int fd, const void *s, size_t n)
#define EXPECT_EQ(lhs, rhs)
A macro which verifies that lhs and rhs are equal to each other.