Changeset 2212:0ad3835449f8 in lemon0.x for test/dim_test.cc
 Timestamp:
 09/08/06 10:55:07 (13 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2940
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/dim_test.cc
r2207 r2212 30 30 typedef dim2::Point<int> Point; 31 31 32 Point seged; 33 Point a(1,2); 34 Point b(3,4); 32 Point seged; 33 check(seged.size()==2, "Wrong vector addition"); 35 34 36 seged = a+b;37 check(seged.x==4 && seged.y==6, "Wrong vector addition");35 Point a(1,2); 36 Point b(3,4); 38 37 39 seged = ab; 40 check(seged.x==2 && seged.y==2, "ab"); 38 check(a[0]==1 && a[1]==2, "Wrong vector addition"); 41 39 42 check(a.normSquare()==5,"Wrong norm calculation");43 check(a*b==11, "a*b");40 seged = a+b; 41 check(seged.x==4 && seged.y==6, "Wrong vector addition"); 44 42 45 int l=2; 46 seged = a*l; 47 check(seged.x==2 && seged.y==4, "a*l"); 43 seged = ab; 44 check(seged.x==2 && seged.y==2, "ab"); 48 45 49 seged = b/l;50 check(seged.x==1 && seged.y==2, "b/l");46 check(a.normSquare()==5,"Wrong norm calculation"); 47 check(a*b==11, "a*b"); 51 48 52 typedef dim2::BoundingBox<int> BB; 53 BB doboz1; 54 check(doboz1.empty(), "It should be empty."); 49 int l=2; 50 seged = a*l; 51 check(seged.x==2 && seged.y==4, "a*l"); 52 53 seged = b/l; 54 check(seged.x==1 && seged.y==2, "b/l"); 55 56 typedef dim2::BoundingBox<int> BB; 57 BB doboz1; 58 check(doboz1.empty(), "It should be empty."); 55 59 56 57 58 60 doboz1.add(a); 61 check(!doboz1.empty(), "It should not be empty."); 62 doboz1.add(b); 59 63 60 61 62 63 64 64 check(doboz1.bottomLeft().x==1 && 65 doboz1.bottomLeft().y==2 && 66 doboz1.topRight().x==3 && 67 doboz1.topRight().y==4, 68 "added points to box"); 65 69 66 67 70 seged.x=2;seged.y=3; 71 check(doboz1.inside(seged),"It should be inside."); 68 72 69 70 73 seged.x=1;seged.y=3; 74 check(doboz1.inside(seged),"It should be inside."); 71 75 72 73 76 seged.x=0;seged.y=3; 77 check(!doboz1.inside(seged),"It should not be inside."); 74 78 75 76 77 79 BB doboz2(seged); 80 check(!doboz2.empty(), 81 "It should not be empty. Constructed from 1 point."); 78 82 79 80 81 83 doboz2.add(doboz1); 84 check(doboz2.inside(seged), 85 "It should be inside. Incremented a box with another one."); 82 86 }
Note: See TracChangeset
for help on using the changeset viewer.