Changeset 516:c37949721c61 in lemon-0.x for src
- Timestamp:
- 05/04/04 10:31:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@678
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
src/test/xy_test.cc
r513 r516 6 6 bool passed = true; 7 7 8 void check(bool rc ) {8 void check(bool rc, char *msg="") { 9 9 passed = passed && rc; 10 10 if(!rc) { 11 cout << "Test failed!" << endl; 11 std::cerr << "Test failed! ("<< msg << ")" << std::endl; \ 12 13 12 14 } 13 15 } … … 30 32 31 33 seged = a-b; 32 check(seged.x==- 1 && seged.y==-1);34 check(seged.x==-2 && seged.y==-2, "a-b"); 33 35 34 36 check(a.normSquare()==5); 35 check(a*b==11 );37 check(a*b==11, "a*b"); 36 38 37 39 int l=2; 38 40 seged = a*l; 39 check(seged.x==2 && seged.y==4 );41 check(seged.x==2 && seged.y==4, "a*l"); 40 42 41 43 seged = b/l; 42 check(seged.x==1 && seged.y==2 );44 check(seged.x==1 && seged.y==2, "b/l"); 43 45 44 46 typedef BoundingBox<int> BB; 45 47 BB doboz1; 48 check(doboz1.empty(), "empty? Should be."); 49 46 50 doboz1 += a; 51 check(!doboz1.empty(), "empty? Should not be."); 47 52 doboz1 += b; 53 54 check(doboz1.bottomLeft().x==1 && 55 doboz1.bottomLeft().y==2 && 56 doboz1.topRight().x==3 && 57 doboz1.topRight().y==4, 58 "added points to box"); 59 60 seged.x=2;seged.y=3; 61 check(doboz1.inside(seged),"Inside? Should be."); 62 63 seged.x=1;seged.y=3; 64 check(doboz1.inside(seged),"Inside? Should be."); 65 66 seged.x=0;seged.y=3; 67 check(!doboz1.inside(seged),"Inside? Should not be."); 68 69 BB doboz2(seged); 70 check(!doboz2.empty(), "empty? Should not be."); 71 72 doboz2 += doboz1; 73 check(doboz2.inside(seged),"Inside? Should be."); 48 74 49 75 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
Note: See TracChangeset
for help on using the changeset viewer.