am a04e1ee5: am 04bbc0ad: am da8cda05: Clean up IntArrayViewTest
* commit 'a04e1ee550abe2cee42b3e030f2c1c7dc72c09ea': Clean up IntArrayViewTest
commit
d487879d65
|
@ -23,8 +23,8 @@
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST(MemoryViewTest, TestAccess) {
|
TEST(IntArrayViewTest, TestAccess) {
|
||||||
std::vector<int> intVector = {3, 2, 1, 0, -1, -2};
|
const std::vector<int> intVector = {3, 2, 1, 0, -1, -2};
|
||||||
IntArrayView intArrayView(intVector);
|
IntArrayView intArrayView(intVector);
|
||||||
EXPECT_EQ(intVector.size(), intArrayView.size());
|
EXPECT_EQ(intVector.size(), intArrayView.size());
|
||||||
for (int i = 0; i < static_cast<int>(intVector.size()); ++i) {
|
for (int i = 0; i < static_cast<int>(intVector.size()); ++i) {
|
||||||
|
@ -32,15 +32,15 @@ TEST(MemoryViewTest, TestAccess) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MemoryViewTest, TestIteration) {
|
TEST(IntArrayViewTest, TestIteration) {
|
||||||
std::vector<int> intVector = {3, 2, 1, 0, -1, -2};
|
const std::vector<int> intVector = {3, 2, 1, 0, -1, -2};
|
||||||
IntArrayView intArrayView(intVector);
|
IntArrayView intArrayView(intVector);
|
||||||
std::set<int> intSet(intVector.begin(), intVector.end());
|
size_t expectedIndex = 0;
|
||||||
for (const int i : intArrayView) {
|
for (const int element : intArrayView) {
|
||||||
EXPECT_TRUE(intSet.count(i) > 0);
|
EXPECT_EQ(intVector[expectedIndex], element);
|
||||||
intSet.erase(i);
|
++expectedIndex;
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(intSet.empty());
|
EXPECT_EQ(expectedIndex, intArrayView.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue