52 const Container kEmptyEl = Container();
53 auto intersection = Intersection<Container, Const_IT>
54 (kEmptyEl.begin(), kEmptyEl.end(), kEmptyEl.begin(), kEmptyEl.end());
55 EXPECT_EQ(0, intersection.size());
60 const Container kEmptyEl = Container();
61 const Container kCollection = Container(10,1);
62 Container intersection = Intersection<Container, Const_IT>
63 (kEmptyEl.begin(), kEmptyEl.end(), kCollection.begin(), kCollection.end());
64 EXPECT_EQ(0, intersection.size());
69 const Container kSortedArray(SortedArrayInt, SortedArrayInt +
sizeof(SortedArrayInt) /
sizeof(Value));
70 Container intersection = Intersection<Container, Const_IT>
71 (kSortedArray.begin(), kSortedArray.end(), kSortedArray.begin(), kSortedArray.end());
74 Const_IT kIntersectIt = intersection.begin();
75 for (Const_IT it = kSortedArray.begin(); it != kSortedArray.end(); ++it, ++kIntersectIt)
76 EXPECT_EQ(*it, *kIntersectIt);
81 const Container kFirstRandom(RandomArrayInt, RandomArrayInt +
sizeof(RandomArrayInt) /
sizeof(Value));
82 const Container kSecondRandom(RandomArrayInt, RandomArrayInt +
sizeof(RandomArrayInt) /
sizeof(Value));
84 Container intersection = Intersection<Container, Const_IT>
85 (kFirstRandom.begin(), kFirstRandom.end(), kSecondRandom.begin(), kSecondRandom.end());
88 Const_IT kIntersectIt = intersection.begin();
89 for (Const_IT it = kFirstRandom.begin(); it != kFirstRandom.end(); ++it, ++kIntersectIt)
90 EXPECT_EQ(*it, *kIntersectIt);
95 const Container kFirstRandom(RandomArrayInt, RandomArrayInt +
sizeof(RandomArrayInt) /
sizeof(Value));
96 const Container kSecondRandom
97 (RandomArrayInterInt, RandomArrayInterInt +
sizeof(RandomArrayInterInt) /
sizeof(Value));
99 Container intersection = Intersection<Container, Const_IT>
100 (kFirstRandom.begin(), kFirstRandom.end(), kSecondRandom.begin(), kSecondRandom.end());
103 std::sort(intersection.begin(), intersection.end());
104 EXPECT_EQ(-18, intersection[0]);
105 EXPECT_EQ(-5, intersection[1]);
106 EXPECT_EQ(3, intersection[2]);
107 EXPECT_EQ(5, intersection[3]);
108 EXPECT_EQ(5, intersection[4]);
113 std::string intersection = Intersection<std::string, std::string::const_iterator>
114 (OrderedStr.begin(), OrderedStr.end(), RandomStr.begin(), RandomStr.end());
117 std::sort(intersection.begin(), intersection.end());
118 EXPECT_EQ(
'a', intersection[0]);
119 EXPECT_EQ(
'c', intersection[1]);
120 EXPECT_EQ(
'e', intersection[2]);
121 EXPECT_EQ(
'g', intersection[3]);