Skip to content

Commit fb86dc0

Browse files
Copilotnunoplopes
andauthored
Add duplicate-max vector test
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
1 parent d5cf994 commit fb86dc0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎tests/unit/max.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <algorithm>
22
#include <cassert>
3+
#include <vector>
34

45
int main() {
56
int x1 = 1, x2 = 2, x3 = 10, x4 = 20;
@@ -10,5 +11,8 @@ int main() {
1011
int r4 = std::min(*p2, x3);
1112
int r5 = std::max(30, 40);
1213
assert(r1 + r2 + r3 + r4 + r5 == 56);
14+
std::vector<int> values{1, 7, 7, 3};
15+
auto max = std::max_element(values.begin(), values.end());
16+
assert(max == values.begin() + 1);
1317
return 0;
1418
}

0 commit comments

Comments
 (0)