38#include <gtest/gtest.h>
51TEST(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]);
78TEST(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]);
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);
TEST(AtomicioTest, AtomicReadBigBuffer)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
ssize_t atomic_read(int fd, void *s, size_t n)
ssize_t atomic_write(int fd, const void *s, size_t n)