Home | History | Annotate | Download | only in tests

Lines Matching defs:MAX_LEN

156   StringTestState(size_t MAX_LEN) : MAX_LEN(MAX_LEN), align1_index_(0), align2_index_(0) {
159 // TODO: fix the tests to not sometimes use twice their specified "MAX_LEN".
160 glob_ptr = reinterpret_cast<Character*>(memalign(sysconf(_SC_PAGESIZE), 2 * sizeof(Character) * MAX_LEN + max_alignment));
161 glob_ptr1 = reinterpret_cast<Character*>(memalign(sysconf(_SC_PAGESIZE), 2 * sizeof(Character) * MAX_LEN + max_alignment));
162 glob_ptr2 = reinterpret_cast<Character*>(memalign(sysconf(_SC_PAGESIZE), 2 * sizeof(Character) * MAX_LEN + max_alignment));
201 const size_t MAX_LEN;
214 // smallest (0) and biggest (MAX_LEN) lengths. Avoid repeats.
220 size_t l = static_cast<size_t>(exp(log(static_cast<double>(MAX_LEN)) * i / ITER));
225 len[n++] = MAX_LEN;
249 memset(state.ptr2, '\2', state.MAX_LEN);
250 state.ptr2[state.MAX_LEN - 1] = '\0';
251 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN);
257 strcpy(state.ptr + state.MAX_LEN - 1, state.ptr1);
260 EXPECT_TRUE(memcmp(state.ptr, state.ptr2, 2 * state.MAX_LEN) == 0);
438 size_t pos = random() % state.MAX_LEN;
460 memset(state.ptr1, 'v', state.MAX_LEN);
461 memset(state.ptr2, 'n', state.MAX_LEN);
465 size_t pos = 1 + (random() % (state.MAX_LEN - 1));
494 size_t pos = random() % state.MAX_LEN;
498 state.ptr1[state.MAX_LEN - 1] = '\0';
500 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
502 memset(state.ptr2, '\1', state.MAX_LEN);
503 state.ptr2[state.MAX_LEN - 1] = '\0';
505 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
506 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1);
507 state.ptr[2 * state.MAX_LEN - 1] = '\0';
510 ASSERT_FALSE((memcmp(state.ptr1, state.ptr, state.MAX_LEN)) != 0 ||
511 (memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
518 size_t pos = random() % state.MAX_LEN;
522 state.ptr1[state.MAX_LEN - 1] = '\0';
524 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
526 memset(state.ptr2, '\1', state.MAX_LEN);
527 state.ptr2[state.MAX_LEN - 1] = '\0';
529 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
530 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1);
531 state.ptr[2 * state.MAX_LEN - 1] = '\0';
534 ASSERT_FALSE((memcmp(state.ptr1, state.ptr, state.MAX_LEN)) != 0 ||
535 (memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
544 memset(state.ptr2, '\2', state.MAX_LEN + state.len[i]);
545 state.ptr2[state.MAX_LEN - 1] = '\0';
546 memcpy(state.ptr, state.ptr2, state.MAX_LEN + state.len[i]);
548 size_t pos = random() % state.MAX_LEN;
552 memcpy(state.ptr + state.MAX_LEN - 1, state.ptr1, pos + 1);
554 memcpy(state.ptr + state.MAX_LEN - 1, state.ptr1, state.len[i]);
555 state.ptr[state.MAX_LEN + state.len[i] - 1] = '\0';
558 strlcat(state.ptr2, state.ptr1, state.MAX_LEN + state.len[i]);
560 ASSERT_TRUE(memcmp(state.ptr, state.ptr2, state.MAX_LEN + state.len[i]) == 0);
573 memset(state.ptr1, rand, state.MAX_LEN);
575 size_t pos = random() % state.MAX_LEN;
576 if (pos < state.MAX_LEN) {
579 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
581 memset(state.ptr2, 'I', state.MAX_LEN);
582 memcpy(state.ptr + state.MAX_LEN, state.ptr2, state.MAX_LEN);
584 if (pos > state.MAX_LEN - 1) {
585 memcpy(state.ptr + state.MAX_LEN, state.ptr1, state.MAX_LEN);
586 state.ptr[2 * state.MAX_LEN - 1] = '\0';
588 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1);
591 ASSERT_EQ(strlcpy(state.ptr2, state.ptr1, state.MAX_LEN), strlen(state.ptr1));
592 ASSERT_FALSE((memcmp(state.ptr1, state.ptr, state.MAX_LEN) != 0) ||
593 (memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN) != 0));
604 memset(state.ptr2, '\2', state.MAX_LEN);
605 state.ptr2[state.MAX_LEN - 1] = '\0';
606 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN);
615 strncpy(state.ptr + state.MAX_LEN - 1, state.ptr1, std::min(actual, pos));
616 state.ptr[state.MAX_LEN + std::min(actual, pos) - 1] = '\0';
619 ASSERT_EQ(memcmp(state.ptr, state.ptr2, 2 * state.MAX_LEN), 0);
628 memset(state.ptr1, 'v', state.MAX_LEN);
629 memset(state.ptr2, 'n', state.MAX_LEN);
633 size_t pos = 1 + (random() % (state.MAX_LEN - 1));
662 memset(state.ptr1, 'J', state.MAX_LEN);
664 size_t ptr1_len = random() % state.MAX_LEN;
667 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
669 memset(state.ptr2, '\1', state.MAX_LEN);
672 size_t copy_len = random() % state.MAX_LEN;
675 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
676 memcpy(state.ptr + state.MAX_LEN, state.ptr1, copy_len);
679 memset(state.ptr + state.MAX_LEN + ptr1_len, '\0', copy_len - ptr1_len);
688 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr, state.MAX_LEN));
690 ASSERT_EQ(0, memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN));
699 memset(state.ptr1, 'K', state.MAX_LEN);
701 size_t ptr1_len = random() % state.MAX_LEN;
704 memcpy(state.ptr, state.ptr1, state.MAX_LEN);
706 memset(state.ptr2, '\1', state.MAX_LEN);
709 size_t copy_len = random() % state.MAX_LEN;
712 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN);
713 memcpy(state.ptr + state.MAX_LEN, state.ptr1, copy_len);
716 memset(state.ptr + state.MAX_LEN + ptr1_len, '\0', copy_len - ptr1_len);
725 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr, state.MAX_LEN));
727 ASSERT_EQ(0, memcmp(state.ptr2, state.ptr + state.MAX_LEN, state.MAX_LEN));
743 size_t pos = random() % state.MAX_LEN;
768 size_t pos = random() % state.MAX_LEN;
797 size_t pos = random() % state.MAX_LEN;
817 memset(state.ptr1, c1, state.MAX_LEN);
818 memset(state.ptr2, c1, state.MAX_LEN);
824 int actual = memcmp(state.ptr1, state.ptr2, state.MAX_LEN);
839 wmemset(state.ptr1, c1, state.MAX_LEN);
840 wmemset(state.ptr2, c1, state.MAX_LEN);
846 int actual = wmemcmp(state.ptr1, state.ptr2, (size_t) state.MAX_LEN);
858 size_t pos = random() % (state.MAX_LEN - state.len[i]);
861 memset(state.ptr1 + state.len[i], ~rand, state.MAX_LEN - state.len[i]);
864 memset(state.ptr2 + state.len[i], ~rand, state.MAX_LEN - state.len[i]);
868 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, state.MAX_LEN));
878 memset(state.ptr1, ~ch, state.MAX_LEN);
879 memcpy(state.ptr2, state.ptr1, state.MAX_LEN);
881 size_t pos = random () % (state.MAX_LEN - state.len[i]);
888 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, state.MAX_LEN));
897 memset(state.ptr1, 'Q', 2 * state.MAX_LEN);
899 size_t pos = random() % (state.MAX_LEN - state.len[i]);
902 memcpy(state.ptr2, state.ptr1, 2 * state.MAX_LEN);
907 ASSERT_EQ(0, memcmp(state.ptr2, state.ptr1, 2 * state.MAX_LEN));
995 memset(state.ptr1, '4', state.MAX_LEN);
996 memset(state.ptr1 + state.MAX_LEN, 'a', state.MAX_LEN);
997 memcpy(state.ptr2, state.ptr1, 2 * state.MAX_LEN);
999 size_t start = random() % (2 * state.MAX_LEN - state.len[i]);
1003 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, 2 * state.MAX_LEN));
1011 memset(state.ptr1, 'R', state.MAX_LEN);
1013 size_t start = random() % state.MAX_LEN;
1014 size_t end = start + random() % (state.MAX_LEN - start);
1018 memcpy(state.ptr2 + end, state.ptr1 + end, state.MAX_LEN - end);
1022 ASSERT_EQ(0, memcmp(state.ptr1, state.ptr2, state.MAX_LEN));