[Lemon-commits] Peter Kovacs: Improve test/dim_test.cc
Lemon HG
hg at lemon.cs.elte.hu
Tue Jul 29 15:07:30 CEST 2008
details: http://lemon.cs.elte.hu/hg/lemon/rev/dbe3fc9c875d
changeset: 242:dbe3fc9c875d
user: Peter Kovacs <kpeter [at] inf.elte.hu>
date: Tue Jul 29 14:41:55 2008 +0200
description:
Improve test/dim_test.cc
diffstat:
1 file changed, 20 insertions(+), 16 deletions(-)
test/dim_test.cc | 36 ++++++++++++++++++++----------------
diffs (50 lines):
diff -r 92f046dd7f6c -r dbe3fc9c875d test/dim_test.cc
--- a/test/dim_test.cc Tue Jul 29 14:41:16 2008 +0200
+++ b/test/dim_test.cc Tue Jul 29 14:41:55 2008 +0200
@@ -58,26 +58,30 @@
check(!box1.empty(), "Wrong empty() in dim2::BoundingBox.");
box1.add(b);
- check(box1.bottomLeft().x==1 &&
- box1.bottomLeft().y==2 &&
- box1.topRight().x==3 &&
- box1.topRight().y==4,
+ check(box1.left()==1 && box1.bottom()==2 &&
+ box1.right()==3 && box1.top()==4,
"Wrong addition of points to dim2::BoundingBox.");
- p.x=2; p.y=3;
- check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
+ check(box1.inside(Point(2,3)), "Wrong inside() in dim2::BoundingBox.");
+ check(box1.inside(Point(1,3)), "Wrong inside() in dim2::BoundingBox.");
+ check(!box1.inside(Point(0,3)), "Wrong inside() in dim2::BoundingBox.");
- p.x=1; p.y=3;
- check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
-
- p.x=0; p.y=3;
- check(!box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
-
- BB box2(p);
+ BB box2(Point(2,2));
check(!box2.empty(), "Wrong empty() in dim2::BoundingBox.");
-
- box2.add(box1);
- check(box2.inside(p), "Wrong inside() in dim2::BoundingBox.");
+
+ box2.bottomLeft(Point(2,0));
+ box2.topRight(Point(5,3));
+ BB box3 = box1 & box2;
+ check(!box3.empty() &&
+ box3.left()==2 && box3.bottom()==2 &&
+ box3.right()==3 && box3.top()==3,
+ "Wrong intersection of two dim2::BoundingBox objects.");
+
+ box1.add(box2);
+ check(!box1.empty() &&
+ box1.left()==1 && box1.bottom()==0 &&
+ box1.right()==5 && box1.top()==4,
+ "Wrong addition of two dim2::BoundingBox objects.");
return 0;
}
More information about the Lemon-commits
mailing list