Merge branch 'development'

This commit is contained in:
John Wellbelove 2020-08-30 12:11:48 +01:00
commit 4605a8d3c4
2 changed files with 34 additions and 0 deletions

View File

@ -248,6 +248,22 @@ namespace etl
}
}
//***************************************************
/// Equality operator
//***************************************************
friend bool operator ==(const bresenham_line& lhs, const bresenham_line& rhs)
{
return (lhs.front() == rhs.front()) && (lhs.back() == rhs.back());
}
//***************************************************
/// Inequality operator
//***************************************************
friend bool operator !=(const bresenham_line& lhs, const bresenham_line& rhs)
{
return !(lhs == rhs);
}
private:
//***************************************************

View File

@ -404,5 +404,23 @@ namespace
CHECK_EQUAL(expected.size(), actual.size());
CHECK_ARRAY_EQUAL(expected.data(), actual.data(), (std::max(expected.size(), actual.size())));
}
//*************************************************************************
TEST(test_equality)
{
BresenhamLine bl1(0, 1, 2, 3);
BresenhamLine bl2(0, 1, 2, 3);
BresenhamLine bl3(0, 1, 2, 4);
BresenhamLine bl4(0, 2, 2, 3);
CHECK(bl1 == bl2);
CHECK(!(bl1 != bl2));
CHECK(bl1 != bl3);
CHECK(!(bl1 == bl3));
CHECK(bl1 != bl4);
CHECK(!(bl1 == bl4));
}
};
}