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