38 #include <gtest/gtest.h>
51 TEST(AtomicioTest, AtomicReadBigBuffer)
56 std::string file_contents =
"This is just some test data to ensure that we"
57 " can read correctly from a file.";
59 fputs(file_contents.c_str(), file);
68 EXPECT_EQ(file_contents.size(), size);
69 for (
unsigned int i = 0;
i < size;
i++) {
70 EXPECT_EQ(file_contents[
i],
s[
i]);
78 TEST(AtomicioTest, AtomicReadSmallBuffer)
83 std::string file_contents =
"This is just some test data to ensure that we"
84 " can read correctly from a file.";
86 fputs(file_contents.c_str(), file);
96 for (
unsigned int i = 0;
i < size;
i++) {
97 EXPECT_EQ(file_contents[
i],
s[
i]);
104 TEST(AtomicioTest, AtomicWrite)
109 std::string file_contents =
"This is just some test data to ensure that we"
110 " can write correctly to a file.";
113 file_contents.c_str(),
114 file_contents.size());
118 EXPECT_EQ(file_contents.size(), size);
121 for (
unsigned int i = 0; (
c = fgetc(file)) != EOF;
i++) {
122 EXPECT_EQ(file_contents[
i], (
unsigned char)
c);