Merge pull request #2141 from dspinellis/index-fix

Avoid array index out of range
This commit is contained in:
Gennadiy Civil 2019-02-20 13:04:20 -05:00 committed by GitHub
commit 6d4d2f06be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,7 @@ To provide a custom failure message, simply stream it into the macro using the
```c++
ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length";
for (int i = 0; i < x.size(); ++i) {
for (int i = 0; i < std::min(x.size(), y.size()); ++i) {
EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i;
}
```