Commit 4d3c64ac authored by Milo Yip's avatar Milo Yip

Improves SkipWhitespace test

parent a81585b5
...@@ -46,18 +46,23 @@ using namespace rapidjson_simd; ...@@ -46,18 +46,23 @@ using namespace rapidjson_simd;
#endif #endif
TEST(SIMD, SIMD_SUFFIX(SkipWhitespace)) { TEST(SIMD, SIMD_SUFFIX(SkipWhitespace)) {
for (int step = 1; step < 32; step++) {
char buffer[1025]; char buffer[1025];
for (size_t i = 0; i < 1024; i++) for (size_t i = 0; i < 1024; i++)
buffer[i] = " \t\r\n"[i % 4]; buffer[i] = " \t\r\n"[i % 4];
for (size_t i = 0; i < 1024; i += 31) for (size_t i = 0; i < 1024; i += step)
buffer[i] = 'X'; buffer[i] = 'X';
buffer[1024] = '\0'; buffer[1024] = '\0';
StringStream s(buffer); StringStream s(buffer);
for(;;) { size_t i = 0;
for (;;) {
SkipWhitespace(s); SkipWhitespace(s);
if (s.Peek() == '\0') if (s.Peek() == '\0')
break; break;
EXPECT_EQ(i, s.Tell());
EXPECT_EQ('X', s.Take()); EXPECT_EQ('X', s.Take());
i += step;
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment