30#if defined(unix) || defined(__unix__) || defined(__unix)
32#ifdef _POSIX_MAPPED_FILES
39 virtual void SetUp() {
43 temp_ = (
char *)malloc(length_ + 1);
44 memcpy(temp_, json_, length_);
45 checkSum_ = CheckSum();
50 for (
size_t i = 0; i < length_; ++i)
55 virtual void TearDown() {
66 for (
int i = 0; i < kTrialCount; i++)
71 for (
int i = 0; i < kTrialCount; i++) {
72 size_t l = strlen(json_);
78 for (
int i = 0; i < kTrialCount; i++) {
79 EXPECT_EQ(0u, memcmp(temp_, json_, length_));
85 for (
int i = 0; i < kTrialCount * kTrialCount; i++)
86 sum += pow(10.0, i & 255);
91 for (
int i = 0; i < kTrialCount; i++) {
92 size_t l = strlen(whitespace_);
98 for (
int i = 0; i < kTrialCount; i++) {
99 size_t l = strspn(whitespace_,
" \n\r\t");
105 for (
int i = 0; i < kTrialCount; i++) {
106 FILE *fp = fopen(filename_,
"rb");
107 ASSERT_EQ(length_, fread(temp_, 1, length_, fp));
115 for (
int i = 0; i < kTrialCount; i++) {
116 int fd = _open(filename_, _O_BINARY | _O_RDONLY);
118 ASSERT_EQ(length_, _read(fd, temp_, length_));
125 for (
int i = 0; i < kTrialCount; i++) {
126 int fd =
open(filename_, O_RDONLY);
128 ASSERT_EQ(length_, read(fd, temp_, length_));
137 for (
int i = 0; i < kTrialCount; i++) {
138 HANDLE file = CreateFile(filename_, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
140 HANDLE mapObject = CreateFileMapping(file, NULL, PAGE_READONLY, 0, length_, NULL);
141 ASSERT_NE(INVALID_HANDLE_VALUE, mapObject);
142 void *
p = MapViewOfFile(mapObject, FILE_MAP_READ, 0, 0, length_);
152#ifdef _POSIX_MAPPED_FILES
154 for (
int i = 0; i < kTrialCount; i++) {
155 int fd =
open(filename_, O_RDONLY);
157 void *
p = mmap(NULL, length_, PROT_READ, MAP_PRIVATE, fd, 0);
#define TEST_F(test_fixture, test_name)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define ASSERT_NE(val1, val2)
#define EXPECT_GT(val1, val2)
#define ASSERT_TRUE(condition)
void close(T *e, websocketpp::connection_hdl hdl)
memcpy((char *) pInfo->slotDescription, s, l)