From 33842f4fe50f156acd5716b88002b3e387042c7d Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 12 Sep 2020 15:02:02 +0100 Subject: [PATCH] Work around for Clang error in etl::bresenham_line tests. --- test/test_bresenham_line.cpp | 78 ++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/test/test_bresenham_line.cpp b/test/test_bresenham_line.cpp index 2478d285..17b9b15d 100644 --- a/test/test_bresenham_line.cpp +++ b/test/test_bresenham_line.cpp @@ -56,8 +56,10 @@ namespace BresenhamLine bl(first.x, first.y, last.x, last.y); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{-5, 5 }, Point{-4, 5 }, Point{-3, 5 }, Point{-2, 5 }, Point{-1, 5 }, Point{ 0, 5 }, Point{ 1, 5 }, Point{ 2, 5 }, Point{ 3, 5 }, Point{ 4, 5 }, Point{ 5, 5} }; @@ -81,8 +83,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 5, 5 }, Point{ 4, 5 }, Point{ 3, 5 }, Point{ 2, 5 }, Point{ 1, 5 }, Point{ 0, 5 }, Point{-1, 5 }, Point{-2, 5 }, Point{-3, 5 }, Point{-4, 5 }, Point{-5, 5} }; @@ -106,8 +110,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 5, -5 }, Point{ 5, -4 }, Point{ 5, -3 }, Point{ 5, -2 }, Point{ 5, -1 }, Point{ 5, 0 }, Point{ 5, 1 }, Point{ 5, 2 }, Point{ 5, 3 }, Point{ 5, 4 }, Point{ 5, 5} }; @@ -131,8 +137,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 5, 5 }, Point{ 5, 4 }, Point{ 5, 3 }, Point{ 5, 2 }, Point{ 5, 1 }, Point{ 5, 0 }, Point{ 5, -1 }, Point{ 5, -2 }, Point{ 5, -3 }, Point{ 5, -4 }, Point{ 5, -5} }; @@ -156,8 +164,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ -5, -3 }, Point{ -4, -3 }, Point{ -3, -2 }, Point{ -2, -1 }, Point{ -1, -1 }, Point{ 0, 0 }, Point{ 1, 1 }, Point{ 2, 1 }, Point{ 3, 2 }, Point{ 4, 2 }, Point{ 5, 3 } }; @@ -181,8 +191,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 5, 3 }, Point{ 4, 3 }, Point{ 3, 2 }, Point{ 2, 1 }, Point{ 1, 1 }, Point{ 0, 0 }, Point{ -1, -1 }, Point{ -2, -1 }, Point{ -3, -2 }, Point{ -4, -2 }, Point{ -5, -3 } }; @@ -206,8 +218,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 5, -3 }, Point{ 4, -3 }, Point{ 3, -2 }, Point{ 2, -1 }, Point{ 1, -1 }, Point{ 0, 0 }, Point{ -1, 1 }, Point{ -2, 1 }, Point{ -3, 2 }, Point{ -4, 2 }, Point{ -5, 3 } }; @@ -231,8 +245,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ -5, 3 }, Point{ -4, 3 }, Point{ -3, 2 }, Point{ -2, 1 }, Point{ -1, 1 }, Point{ 0, 0 }, Point{ 1, -1 }, Point{ 2, -1 }, Point{ 3, -2 }, Point{ 4, -2 }, Point{ 5, -3 } }; @@ -256,8 +272,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ -3, -5 }, Point{ -3, -4 }, Point{ -2, -3 }, Point{ -1, -2 }, Point{ -1, -1 }, Point{ 0, 0 }, Point{ 1, 1 }, Point{ 1, 2 }, Point{ 2, 3 }, Point{ 2, 4 }, Point{ 3, 5 } }; @@ -281,8 +299,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 3, 5 }, Point{ 3, 4 }, Point{ 2, 3 }, Point{ 1, 2 }, Point{ 1, 1 }, Point{ 0, 0 }, Point{ -1, -1 }, Point{ -1, -2 }, Point{ -2, -3 }, Point{ -2, -4 }, Point{ -3, -5 } }; @@ -306,8 +326,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ 3, -5 }, Point{ 3, -4 }, Point{ 2, -3 }, Point{ 1, -2 }, Point{ 1, -1 }, Point{ 0, 0 }, Point{ -1, 1 }, Point{ -1, 2 }, Point{ -2, 3 }, Point{ -2, 4 }, Point{ -3, 5 } }; @@ -331,8 +353,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); std::vector expected{ Point{ -3, 5 }, Point{ -3, 4 }, Point{ -2, 3 }, Point{ -1, 2 }, Point{ -1, 1 }, Point{ 0, 0 }, Point{ 1, -1 }, Point{ 1, -2 }, Point{ 2, -3 }, Point{ 2, -4 }, Point{ 3, -5 } }; @@ -356,8 +380,10 @@ namespace BresenhamLine bl(first, last); - CHECK_EQUAL(first, bl.front()); - CHECK_EQUAL(last, bl.back()); + CHECK_EQUAL(first.x, bl.front().x); + CHECK_EQUAL(first.y, bl.front().y); + CHECK_EQUAL(last.x, bl.back().x); + CHECK_EQUAL(last.y, bl.back().y); Point new_first = { -3, 5 }; Point new_last = { 3, -5 };