Lines Matching defs:MAX_LEN

166   explicit StringTestState(size_t MAX_LEN) : MAX_LEN(MAX_LEN), align1_index_(0), align2_index_(0) {
169 // TODO: fix the tests to not sometimes use twice their specified "MAX_LEN".
170 glob_ptr = reinterpret_cast<Character*>(memalign(sysconf(_SC_PAGESIZE), 2 * sizeof(Character) * MAX_LEN + max_alignment));
171 glob_ptr1 = reinterpret_cast<Character*>(memalign(sysconf(_SC_PAGESIZE), 2 * sizeof(Character) * MAX_LEN + max_alignment));
172 glob_ptr2 = reinterpret_cast<Character*>(memalign(sysconf(_SC_PAGESIZE), 2 * sizeof(Character) * MAX_LEN + max_alignment));
211 const size_t MAX_LEN;
224 // smallest (0) and biggest (MAX_LEN) lengths. Avoid repeats.
230 size_t l = static_cast<size_t>(exp(log(static_cast<double>(MAX_LEN)) * i / ITER));
235 len[n++] = MAX_LEN;
259 memset(state.ptr2, '\2', state.MAX_LEN);
260 state.ptr2[state.MAX_LEN - 1] = '\0';
261 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN);
267 strcpy(state.ptr + state.MAX_LEN - 1, state.ptr1);
270 EXPECT_TRUE(memcmp(state.ptr, state.ptr2, 2 * state.MAX_LEN) == 0);
448 size_t pos = random() % state.MAX_LEN;
477 memset(state.ptr1, 'v', state.MAX_LEN);
478 memset(state.ptr2, 'n', state.MAX_LEN);
482 size_t pos = 1 + (random() % (state.MAX_LEN - 1));
511 size_t pos = random() % state.MAX_LEN;
515 state.ptr1[state.MAX_LEN - 1] = '\0';
517 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
519 memset(state.ptr2, '\1', state.MAX_LEN);
520 state.ptr2[state.MAX_LEN - 1] = '\0';
522 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
523 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1);
524 state.ptr[2 * state.MAX_LEN - 1] = '\0';
527 ASSERT_FALSE((memcmp(state.ptr1, state.ptr, state.MAX_LEN)) != 0 ||
528 (memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
535 size_t pos = random() % state.MAX_LEN;
539 state.ptr1[state.MAX_LEN - 1] = '\0';
541 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
543 memset(state.ptr2, '\1', state.MAX_LEN);
544 state.ptr2[state.MAX_LEN - 1] = '\0';
546 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
547 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1);
548 state.ptr[2 * state.MAX_LEN - 1] = '\0';
551 ASSERT_FALSE((memcmp(state.ptr1, state.ptr, state.MAX_LEN)) != 0 ||
552 (memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
561 memset(state.ptr2, '\2', state.MAX_LEN + state.len[i]);
562 state.ptr2[state.MAX_LEN - 1] = '\0';
563 memcpy(state.ptr, state.ptr2, state.MAX_LEN + state.len[i]);
565 size_t pos = random() % state.MAX_LEN;
569 memcpy(state.ptr + state.MAX_LEN - 1, state.ptr1, pos + 1);
571 memcpy(state.ptr + state.MAX_LEN - 1, state.ptr1, state.len[i]);
572 state.ptr[state.MAX_LEN + state.len[i] - 1] = '\0';
575 strlcat(state.ptr2, state.ptr1, state.MAX_LEN + state.len[i]);
577 ASSERT_TRUE(memcmp(state.ptr, state.ptr2, state.MAX_LEN + state.len[i]) == 0);
590 memset(state.ptr1, rand, state.MAX_LEN);
592 size_t pos = random() % state.MAX_LEN;
593 if (pos < state.MAX_LEN) {
596 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
598 memset(state.ptr2, 'I', state.MAX_LEN);
599 memcpy(state.ptr + state.MAX_LEN, state.ptr2, state.MAX_LEN);
601 if (pos > state.MAX_LEN - 1) {
602 memcpy(state.ptr + state.MAX_LEN, state.ptr1, state.MAX_LEN);
603 state.ptr[2 * state.MAX_LEN - 1] = '\0';
605 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1);
608 ASSERT_EQ(strlcpy(state.ptr2, state.ptr1, state.MAX_LEN), strlen(state.ptr1));
609 ASSERT_FALSE((memcmp(state.ptr1, state.ptr, state.MAX_LEN) != 0) ||
610 (memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
621 memset(state.ptr2, '\2', state.MAX_LEN);
622 state.ptr2[state.MAX_LEN - 1] = '\0';
623 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN);
632 strncpy(state.ptr + state.MAX_LEN - 1, state.ptr1, std::min(actual, pos));
633 state.ptr[state.MAX_LEN + std::min(actual, pos) - 1] = '\0';
636 ASSERT_EQ(memcmp(state.ptr, state.ptr2, 2 * state.MAX_LEN), 0);
645 memset(state.ptr1, 'v', state.MAX_LEN);
646 memset(state.ptr2, 'n', state.MAX_LEN);
650 size_t pos = 1 + (random() % (state.MAX_LEN - 1));
679 memset(state.ptr1, 'J', state.MAX_LEN);
681 size_t ptr1_len = random() % state.MAX_LEN;
684 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
686 memset(state.ptr2, '\1', state.MAX_LEN);
689 size_t copy_len = random() % state.MAX_LEN;
692 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
693 memcpy(state.ptr + state.MAX_LEN, state.ptr1, copy_len);
696 memset(state.ptr + state.MAX_LEN + ptr1_len, '\0', copy_len - ptr1_len);
705 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr, state.MAX_LEN));
707 ASSERT_EQ(0, memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN));
716 memset(state.ptr1, 'K', state.MAX_LEN);
718 size_t ptr1_len = random() % state.MAX_LEN;
721 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
723 memset(state.ptr2, '\1', state.MAX_LEN);
726 size_t copy_len = random() % state.MAX_LEN;
729 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
730 memcpy(state.ptr + state.MAX_LEN, state.ptr1, copy_len);
733 memset(state.ptr + state.MAX_LEN + ptr1_len, '\0', copy_len - ptr1_len);
742 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr, state.MAX_LEN));
744 ASSERT_EQ(0, memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN));
760 size_t pos = random() % state.MAX_LEN;
785 size_t pos = random() % state.MAX_LEN;
814 size_t pos = random() % state.MAX_LEN;
834 memset(state.ptr1, c1, state.MAX_LEN);
835 memset(state.ptr2, c1, state.MAX_LEN);
841 int actual = memcmp(state.ptr1, state.ptr2, state.MAX_LEN);
856 wmemset(state.ptr1, c1, state.MAX_LEN);
857 wmemset(state.ptr2, c1, state.MAX_LEN);
863 int actual = wmemcmp(state.ptr1, state.ptr2, (size_t) state.MAX_LEN);
875 size_t pos = random() % (state.MAX_LEN - state.len[i]);
878 memset(state.ptr1 + state.len[i], ~rand, state.MAX_LEN - state.len[i]);
881 memset(state.ptr2 + state.len[i], ~rand, state.MAX_LEN - state.len[i]);
885 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, state.MAX_LEN));
895 memset(state.ptr1, ~ch, state.MAX_LEN);
896 memcpy(state.ptr2, state.ptr1, state.MAX_LEN);
898 size_t pos = random () % (state.MAX_LEN - state.len[i]);
905 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, state.MAX_LEN));
914 memset(state.ptr1, 'Q', 2 * state.MAX_LEN);
916 size_t pos = random() % (state.MAX_LEN - state.len[i]);
919 memcpy(state.ptr2, state.ptr1, 2 * state.MAX_LEN);
924 ASSERT_EQ(0, memcmp(state.ptr2, state.ptr1, 2 * state.MAX_LEN));
1012 memset(state.ptr1, '4', state.MAX_LEN);
1013 memset(state.ptr1 + state.MAX_LEN, 'a', state.MAX_LEN);
1014 memcpy(state.ptr2, state.ptr1, 2 * state.MAX_LEN);
1016 size_t start = random() % (2 * state.MAX_LEN - state.len[i]);
1020 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, 2 * state.MAX_LEN));
1028 memset(state.ptr1, 'R', state.MAX_LEN);
1030 size_t start = random() % state.MAX_LEN;
1031 size_t end = start + random() % (state.MAX_LEN - start);
1035 memcpy(state.ptr2 + end, state.ptr1 + end, state.MAX_LEN - end);
1039 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, state.MAX_LEN));