diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2023-12-21 01:02:50 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2023-12-30 01:37:14 +0100 |
commit | b37e243a1e96bb99b42eff9295b448f0241a89b8 (patch) | |
tree | e7844420a6d1a792d1696914a7d24f4f1400ffaa /test | |
parent | 674e603e5575be906ae2926da3f94918f61700fb (diff) |
Transform asserts into ifs for shapes test
The asserts only take effect when building with them enabled.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/shapes.cc | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/test/unit/shapes.cc b/test/unit/shapes.cc index 30aa7d81..f52eab82 100644 --- a/test/unit/shapes.cc +++ b/test/unit/shapes.cc @@ -2,6 +2,7 @@ * Dillo Widget * * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org> + * Copyright 2023 Rodrigo Arias Mallo <rodarima@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,24 +18,32 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - - -#include "../dw/core.hh" +#include "dw/core.hh" using namespace dw::core; using namespace lout::misc; int main() { - Polygon poly; - poly.addPoint (50, 10); - poly.addPoint (90, 90); - poly.addPoint (10, 90); + Polygon poly; + poly.addPoint(50, 10); + poly.addPoint(90, 90); + poly.addPoint(10, 90); + + if (!poly.isPointWithin(50, 50)) { + printf("poly.isPointWithin(50, 50) failed\n"); + exit(1); + } + + if (poly.isPointWithin(10, 10)) { + printf("!poly.isPointWithin(10, 10) failed\n"); + exit(1); + } + + if (poly.isPointWithin(90, 50)) { + printf("!poly.isPointWithin(90, 50) failed\n"); + exit(1); + } - printf("first test\n"); - assert (poly.isPointWithin (50, 50)); - printf("second test\n"); - assert (!poly.isPointWithin (10, 10)); - printf("third test\n"); - assert (!poly.isPointWithin (90, 50)); + return 0; } |