Lines Matching refs:q
115 circular_deque<DestructorCounter> q; in TEST() local
116 q.resize(5, DestructorCounter(&destruct_count)); in TEST()
125 circular_deque<DestructorCounter> q; in TEST() local
126 q.reserve(7); in TEST()
127 q.resize(5, DestructorCounter(&destruct_count)); in TEST()
132 q.emplace_back(&destruct_count); in TEST()
133 q.pop_front(); in TEST()
167 circular_deque<int> q = {1, 2, 3, 4, 5, 6}; in TEST() local
168 q = *&q; // The *& defeats Clang's -Wself-assign warning. in TEST()
169 EXPECT_EQ(6u, q.size()); in TEST()
171 EXPECT_EQ(i + 1, q[i]); in TEST()
175 circular_deque<int> q; in TEST() local
176 EXPECT_TRUE(q.empty()); in TEST()
177 q = {1, 2, 3, 4, 5, 6}; in TEST()
178 EXPECT_EQ(6u, q.size()); in TEST()
180 EXPECT_EQ(i + 1, q[i]); in TEST()
226 circular_deque<int> q = MakeSequence(10); in TEST() local
227 CycleTest(q, [](const circular_deque<int>& q, size_t cycle) { in TEST() argument
229 EXPECT_EQ(expected_size, q.size()); in TEST()
235 EXPECT_EQ(0, q[index]); in TEST()
236 EXPECT_EQ(0, q.at(index)); in TEST()
242 EXPECT_EQ(i, q[index]); in TEST()
243 EXPECT_EQ(i, q.at(index)); in TEST()
251 circular_deque<int> q = MakeSequence(10); in TEST() local
258 const circular_deque<int> const_q(q); in TEST()
260 EXPECT_EQ(expected_front, q.front()); in TEST()
261 EXPECT_EQ(expected_back, q.back()); in TEST()
268 q.pop_front(); in TEST()
269 q.push_back(expected_back); in TEST()
274 const circular_deque<int> const_q(q); in TEST()
276 EXPECT_EQ(expected_front, q.front()); in TEST()
277 EXPECT_EQ(expected_back, q.back()); in TEST()
284 q.pop_back(); in TEST()
285 q.push_front(expected_front); in TEST()
293 circular_deque<int> q; in TEST() local
294 q.reserve(7); // Internal buffer is always 1 larger than requested. in TEST()
295 q.push_back(-1); in TEST()
296 q.push_back(-1); in TEST()
297 q.push_back(-1); in TEST()
298 q.push_back(-1); in TEST()
299 q.push_back(0); in TEST()
300 q.pop_front(); in TEST()
301 q.pop_front(); in TEST()
302 q.pop_front(); in TEST()
303 q.pop_front(); in TEST()
304 q.push_back(1); in TEST()
305 q.push_back(2); in TEST()
306 q.push_back(3); in TEST()
307 q.push_back(4); in TEST()
308 q.push_back(5); in TEST()
310 q.shrink_to_fit(); in TEST()
311 EXPECT_EQ(6u, q.size()); in TEST()
313 EXPECT_EQ(0, q[0]); in TEST()
314 EXPECT_EQ(1, q[1]); in TEST()
315 EXPECT_EQ(2, q[2]); in TEST()
316 EXPECT_EQ(3, q[3]); in TEST()
317 EXPECT_EQ(4, q[4]); in TEST()
318 EXPECT_EQ(5, q[5]); in TEST()
336 circular_deque<int> q = MakeSequence(10); in TEST() local
345 for (int cur : q) { in TEST()
352 for (auto cur = q.crbegin(); cur < q.crend(); cur++) { in TEST()
360 q.pop_front(); in TEST()
361 q.push_back(expected_back); in TEST()
366 const circular_deque<int> const_q(q); in TEST()
368 EXPECT_EQ(expected_front, q.front()); in TEST()
369 EXPECT_EQ(expected_back, q.back()); in TEST()
376 q.pop_back(); in TEST()
377 q.push_front(expected_front); in TEST()
382 circular_deque<int> q = MakeSequence(10); in TEST() local
386 EXPECT_LT(q.begin(), q.end()); in TEST()
387 EXPECT_LE(q.begin(), q.end()); in TEST()
388 EXPECT_LE(q.begin(), q.begin()); in TEST()
390 EXPECT_GT(q.end(), q.begin()); in TEST()
391 EXPECT_GE(q.end(), q.begin()); in TEST()
392 EXPECT_GE(q.end(), q.end()); in TEST()
394 EXPECT_EQ(q.begin(), q.begin()); in TEST()
395 EXPECT_NE(q.begin(), q.end()); in TEST()
397 q.push_front(10); in TEST()
398 q.pop_back(); in TEST()
403 circular_deque<int> q; in TEST() local
406 EXPECT_EQ(q.end(), q.end() + 0); in TEST()
407 EXPECT_EQ(q.end(), q.end() - 0); in TEST()
409 q = MakeSequence(10); in TEST()
413 circular_deque<int>::iterator it = q.begin(); in TEST()
425 circular_deque<int>::const_iterator it = q.begin(); in TEST()
437 circular_deque<int>::iterator it = q.begin(); in TEST()
449 circular_deque<int>::const_iterator it = q.begin(); in TEST()
461 circular_deque<int> q = MakeSequence(10); in TEST() local
467 EXPECT_EQ(0, q.begin() - q.begin()); in TEST()
468 EXPECT_EQ(0, q.end() - q.end()); in TEST()
469 EXPECT_EQ(q.size(), static_cast<size_t>(q.end() - q.begin())); in TEST()
472 circular_deque<int>::iterator eight = q.begin(); in TEST()
474 EXPECT_EQ(8, eight - q.begin()); in TEST()
479 EXPECT_EQ(q.begin(), eight); in TEST()
483 EXPECT_EQ(8, eight - q.begin()); in TEST()
487 EXPECT_EQ(q.begin(), eight); in TEST()
492 q.pop_front(); in TEST()
493 q.push_back(expected_back); in TEST()
498 circular_deque<int> q = MakeSequence(10); in TEST() local
500 circular_deque<int>::iterator begin = q.begin(); in TEST()
504 circular_deque<int>::iterator end = q.end(); in TEST()
513 circular_deque<int> q; in TEST() local
514 q.push_back(4); in TEST()
515 q.push_back(3); in TEST()
516 q.push_back(2); in TEST()
517 q.push_back(1); in TEST()
519 circular_deque<int>::reverse_iterator iter = q.rbegin(); in TEST()
528 EXPECT_EQ(q.rend(), iter); in TEST()
532 circular_deque<int> q; in TEST() local
536 EXPECT_TRUE(q.empty()); in TEST()
537 EXPECT_EQ(0u, q.size()); in TEST()
538 EXPECT_EQ(0u, q.capacity()); in TEST()
541 q.reserve(new_capacity); in TEST()
542 EXPECT_EQ(new_capacity, q.capacity()); in TEST()
546 q.push_back(i); in TEST()
547 EXPECT_EQ(new_capacity, q.size()); in TEST()
548 EXPECT_EQ(new_capacity, q.capacity()); in TEST()
552 q.resize(capacity_2); in TEST()
553 q.shrink_to_fit(); in TEST()
554 EXPECT_EQ(capacity_2, q.size()); in TEST()
555 EXPECT_EQ(capacity_2, q.capacity()); in TEST()
560 circular_deque<int> q; in TEST() local
561 q.resize(big_size); in TEST()
563 size_t big_capacity = q.capacity(); in TEST()
567 q.pop_back(); in TEST()
570 size_t medium_capacity = q.capacity(); in TEST()
574 q.resize(1); in TEST()
575 EXPECT_LT(1u, q.capacity()); in TEST()
577 q.resize(0); in TEST()
578 EXPECT_LT(0u, q.capacity()); in TEST()
581 q.clear(); in TEST()
582 EXPECT_EQ(0u, q.capacity()); in TEST()
586 circular_deque<int> q; in TEST() local
587 EXPECT_TRUE(q.empty()); in TEST()
589 q.resize(10); in TEST()
590 EXPECT_EQ(10u, q.size()); in TEST()
591 EXPECT_FALSE(q.empty()); in TEST()
593 q.clear(); in TEST()
594 EXPECT_EQ(0u, q.size()); in TEST()
595 EXPECT_TRUE(q.empty()); in TEST()
598 EXPECT_EQ(0u, q.capacity()); in TEST()
602 circular_deque<int> q; in TEST() local
606 q.resize(first_size); in TEST()
607 EXPECT_EQ(first_size, q.size()); in TEST()
609 EXPECT_EQ(0, q[i]); in TEST()
613 q.resize(first_size + second_expand, 3); in TEST()
614 EXPECT_EQ(first_size + second_expand, q.size()); in TEST()
616 EXPECT_EQ(0, q[i]); in TEST()
618 EXPECT_EQ(3, q[i + first_size]); in TEST()
622 q.shrink_to_fit(); in TEST()
624 q.pop_back(); in TEST()
625 q.push_front(6); in TEST()
627 q.resize(10); in TEST()
629 EXPECT_EQ(6, q[0]); in TEST()
630 EXPECT_EQ(6, q[1]); in TEST()
631 EXPECT_EQ(6, q[2]); in TEST()
632 EXPECT_EQ(6, q[3]); in TEST()
633 EXPECT_EQ(6, q[4]); in TEST()
634 EXPECT_EQ(0, q[5]); in TEST()
635 EXPECT_EQ(0, q[6]); in TEST()
636 EXPECT_EQ(0, q[7]); in TEST()
637 EXPECT_EQ(0, q[8]); in TEST()
638 EXPECT_EQ(0, q[9]); in TEST()
644 circular_deque<DestructorCounter> q; in TEST() local
645 q.resize(10, DestructorCounter(&counter)); in TEST()
650 EXPECT_EQ(10u, q.capacity()); in TEST()
656 q.resize(8, DestructorCounter(&counter)); in TEST()
666 q.emplace_back(&counter); in TEST()
667 q.pop_front(); in TEST()
674 q.resize(6, DestructorCounter(&counter)); in TEST()
680 circular_deque<int> q; in TEST() local
681 q.push_back(1); in TEST()
682 q.push_back(2); in TEST()
685 auto result = q.insert(q.begin(), 0); in TEST()
686 EXPECT_EQ(q.begin(), result); in TEST()
687 EXPECT_EQ(3u, q.size()); in TEST()
688 EXPECT_EQ(0, q[0]); in TEST()
689 EXPECT_EQ(1, q[1]); in TEST()
690 EXPECT_EQ(2, q[2]); in TEST()
693 result = q.erase(q.begin()); in TEST()
694 EXPECT_EQ(q.begin(), result); in TEST()
695 EXPECT_EQ(2u, q.size()); in TEST()
696 EXPECT_EQ(1, q[0]); in TEST()
697 EXPECT_EQ(2, q[1]); in TEST()
700 result = q.insert(q.end(), 3); in TEST()
701 EXPECT_EQ(q.end() - 1, result); in TEST()
702 EXPECT_EQ(1, q[0]); in TEST()
703 EXPECT_EQ(2, q[1]); in TEST()
704 EXPECT_EQ(3, q[2]); in TEST()
707 result = q.erase(q.end() - 1); in TEST()
708 EXPECT_EQ(q.end(), result); in TEST()
709 EXPECT_EQ(1, q[0]); in TEST()
710 EXPECT_EQ(2, q[1]); in TEST()
713 result = q.insert(q.begin() + 1, 10); in TEST()
714 EXPECT_EQ(q.begin() + 1, result); in TEST()
715 EXPECT_EQ(1, q[0]); in TEST()
716 EXPECT_EQ(10, q[1]); in TEST()
717 EXPECT_EQ(2, q[2]); in TEST()
720 result = q.erase(q.begin() + 1); in TEST()
721 EXPECT_EQ(q.begin() + 1, result); in TEST()
722 EXPECT_EQ(1, q[0]); in TEST()
723 EXPECT_EQ(2, q[1]); in TEST()
727 circular_deque<int> q; in TEST() local
730 q.insert(q.begin(), 2, 1); in TEST()
733 q.insert(q.begin(), 2, 0); in TEST()
736 q.insert(q.begin() + 3, 2, 50); in TEST()
739 q.insert(q.end(), 2, 200); in TEST()
741 ASSERT_EQ(8u, q.size()); in TEST()
742 EXPECT_EQ(0, q[0]); in TEST()
743 EXPECT_EQ(0, q[1]); in TEST()
744 EXPECT_EQ(1, q[2]); in TEST()
745 EXPECT_EQ(50, q[3]); in TEST()
746 EXPECT_EQ(50, q[4]); in TEST()
747 EXPECT_EQ(1, q[5]); in TEST()
748 EXPECT_EQ(200, q[6]); in TEST()
749 EXPECT_EQ(200, q[7]); in TEST()
753 circular_deque<int> q; in TEST() local
756 q.erase(q.begin(), q.end()); in TEST()
763 q.insert(q.begin(), source.begin(), source.end()); in TEST()
769 q.insert(q.begin(), source.begin(), source.end()); in TEST()
774 q.push_back(0); in TEST()
775 q.pop_front(); in TEST()
779 ASSERT_EQ(2u, q.size()); in TEST()
780 q[0] = 100; in TEST()
781 q[1] = 101; in TEST()
784 q.insert(q.begin(), source.begin(), source.end()); in TEST()
785 q.insert(q.begin() + 3, source.begin(), source.end()); in TEST()
786 q.insert(q.end(), source.begin(), source.end()); in TEST()
788 ASSERT_EQ(8u, q.size()); in TEST()
789 EXPECT_EQ(1, q[0]); in TEST()
790 EXPECT_EQ(2, q[1]); in TEST()
791 EXPECT_EQ(100, q[2]); // First inserted one. in TEST()
792 EXPECT_EQ(1, q[3]); in TEST()
793 EXPECT_EQ(2, q[4]); in TEST()
794 EXPECT_EQ(101, q[5]); // First inserted second one. in TEST()
795 EXPECT_EQ(1, q[6]); in TEST()
796 EXPECT_EQ(2, q[7]); in TEST()
800 auto result = q.erase(q.begin(), q.begin()); // No-op. in TEST()
801 EXPECT_EQ(q.begin(), result); in TEST()
802 result = q.erase(q.begin(), q.begin() + 2); in TEST()
803 EXPECT_EQ(q.begin(), result); in TEST()
805 result = q.erase(q.begin() + 1, q.begin() + 1); // No-op. in TEST()
806 EXPECT_EQ(q.begin() + 1, result); in TEST()
807 result = q.erase(q.begin() + 1, q.begin() + 3); in TEST()
808 EXPECT_EQ(q.begin() + 1, result); in TEST()
810 result = q.erase(q.end() - 2, q.end() - 2); // No-op. in TEST()
811 EXPECT_EQ(q.end() - 2, result); in TEST()
812 result = q.erase(q.end() - 2, q.end()); in TEST()
813 EXPECT_EQ(q.end(), result); in TEST()
815 ASSERT_EQ(2u, q.size()); in TEST()
816 EXPECT_EQ(100, q[0]); in TEST()
817 EXPECT_EQ(101, q[1]); in TEST()
820 result = q.erase(q.begin(), q.end()); in TEST()
821 EXPECT_EQ(q.end(), result); in TEST()
822 EXPECT_TRUE(q.empty()); in TEST()
828 circular_deque<MoveOnlyInt> q(std::begin(values), std::end(values)); in TEST() local
830 q.emplace(q.begin(), MoveOnlyInt(0)); in TEST()
831 q.emplace(q.begin() + 2, MoveOnlyInt(2)); in TEST()
832 q.emplace(q.end(), MoveOnlyInt(4)); in TEST()
834 ASSERT_EQ(5u, q.size()); in TEST()
835 EXPECT_EQ(0, q[0].data()); in TEST()
836 EXPECT_EQ(1, q[1].data()); in TEST()
837 EXPECT_EQ(2, q[2].data()); in TEST()
838 EXPECT_EQ(3, q[3].data()); in TEST()
839 EXPECT_EQ(4, q[4].data()); in TEST()
843 circular_deque<int> q; in TEST() local
844 q.reserve(2); in TEST()
846 int& front = q.emplace_front(1); in TEST()
847 int& back = q.emplace_back(2); in TEST()
848 ASSERT_EQ(2u, q.size()); in TEST()
849 EXPECT_EQ(1, q[0]); in TEST()
850 EXPECT_EQ(2, q[1]); in TEST()
852 EXPECT_EQ(&front, &q.front()); in TEST()
853 EXPECT_EQ(&back, &q.back()); in TEST()
858 ASSERT_EQ(2u, q.size()); in TEST()
859 EXPECT_EQ(3, q[0]); in TEST()
860 EXPECT_EQ(4, q[1]); in TEST()
862 EXPECT_EQ(&front, &q.front()); in TEST()
863 EXPECT_EQ(&back, &q.back()); in TEST()