COIN-OR::LEMON - Graph Library

Ticket #126: dim_test_37bc38e00613.patch

File dim_test_37bc38e00613.patch, 1.9 KB (added by Peter Kovacs, 12 years ago)

Improve test/dim_test.cc. It depends on [2ccb860dfdcb].

  • test/dim_test.cc

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1216062154 -7200
    # Node ID 37bc38e006134452b1b5debd8a1d136a66cc6a75
    # Parent  2ccb860dfdcb5152b4006558647e2e63b454bb0b
    Improve test/dim_test.cc
    
    diff -r 2ccb860dfdcb -r 37bc38e00613 test/dim_test.cc
    a b  
    5858  check(!box1.empty(), "Wrong empty() in dim2::BoundingBox.");
    5959  box1.add(b);
    6060
    61   check(box1.bottomLeft().x==1 &&
    62         box1.bottomLeft().y==2 &&
    63         box1.topRight().x==3 &&
    64         box1.topRight().y==4,
     61  check(box1.left()==1 && box1.bottom()==2 &&
     62        box1.right()==3 && box1.top()==4,
    6563        "Wrong addition of points to dim2::BoundingBox.");
    6664
    67   p.x=2; p.y=3;
    68   check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
     65  check(box1.inside(Point(2,3)), "Wrong inside() in dim2::BoundingBox.");
     66  check(box1.inside(Point(1,3)), "Wrong inside() in dim2::BoundingBox.");
     67  check(!box1.inside(Point(0,3)), "Wrong inside() in dim2::BoundingBox.");
    6968
    70   p.x=1; p.y=3;
    71   check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
    72 
    73   p.x=0; p.y=3;
    74   check(!box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
    75 
    76   BB box2(p);
     69  BB box2(Point(1,1));
    7770  check(!box2.empty(), "Wrong empty() in dim2::BoundingBox.");
    78 
    79   box2.add(box1);
    80   check(box2.inside(p), "Wrong inside() in dim2::BoundingBox.");
     71  box2.top(0);
     72  check(box2.empty(), "Wrong empty() in dim2::BoundingBox.");
     73 
     74  box2.bottomLeft(Point(2,0));
     75  box2.topRight(Point(5,3));
     76  BB box3 = box1 & box2;
     77  check(box3.left()==2 && box3.bottom()==2 &&
     78        box3.right()==3 && box3.top()==3,
     79        "Wrong intersection of two dim2::BoundingBox objects.");
     80 
     81  box1.add(box2);
     82  check(box1.left()==1 && box1.bottom()==0 &&
     83        box1.right()==5 && box1.top()==4,
     84        "Wrong addition of two dim2::BoundingBox objects.");
    8185
    8286  return 0;
    8387}