COIN-OR::LEMON - Graph Library

Changeset 171:02f4d5d9bfd7 in lemon for test/dim_test.cc


Ignore:
Timestamp:
06/15/08 22:05:23 (16 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Children:
172:c94a80f38d7f, 173:b026e9779b28, 175:4eb8900a865c
Phase:
public
Message:

Improve and redesign test programs + unify their output (ticket #25)

  • Move graph related utilities form test_tools.h to graph_test.h.
  • Move the contents of graph_utils_test.h to graph_utils_test.cc.
  • Rename map_test.h -> graph_maps_test.h.
  • Rename digraph_test.h -> graph_test.h.
  • Many improvements in the following files:
    • digraph_test.cc
    • graph_test.cc
    • graph_test.h
    • graph_maps_test.h
    • graph_utils_test.cc
    • bfs_test.cc
    • dfs_test.cc
    • counter_test.cc
  • Test programs print messages only if it really seems necessary.
  • Remove \file commands form .cc test files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/dim_test.cc

    r39 r171  
    2626int main()
    2727{
    28   cout << "Testing classes 'dim2::Point' and 'dim2::BoundingBox'." << endl;
    29 
    3028  typedef dim2::Point<int> Point;
    3129
    3230  Point p;
    33   check(p.size()==2, "Wrong vector initialization.");
     31  check(p.size()==2, "Wrong dim2::Point initialization.");
    3432
    3533  Point a(1,2);
    3634  Point b(3,4);
    37   check(a[0]==1 && a[1]==2, "Wrong vector initialization.");
     35  check(a[0]==1 && a[1]==2, "Wrong dim2::Point initialization.");
    3836
    3937  p = a+b;
    40   check(p.x==4 && p.y==6, "Wrong vector addition.");
     38  check(p.x==4 && p.y==6, "Wrong dim2::Point addition.");
    4139
    4240  p = a-b;
    43   check(p.x==-2 && p.y==-2, "Wrong vector subtraction.");
     41  check(p.x==-2 && p.y==-2, "Wrong dim2::Point subtraction.");
    4442
    45   check(a.normSquare()==5,"Wrong vector norm calculation.");
    46   check(a*b==11, "Wrong vector scalar product.");
     43  check(a.normSquare()==5,"Wrong dim2::Point norm calculation.");
     44  check(a*b==11, "Wrong dim2::Point scalar product.");
    4745
    4846  int l=2;
    4947  p = a*l;
    50   check(p.x==2 && p.y==4, "Wrong vector multiplication by a scalar.");
     48  check(p.x==2 && p.y==4, "Wrong dim2::Point multiplication by a scalar.");
    5149
    5250  p = b/l;
    53   check(p.x==1 && p.y==2, "Wrong vector division by a scalar.");
     51  check(p.x==1 && p.y==2, "Wrong dim2::Point division by a scalar.");
    5452
    5553  typedef dim2::BoundingBox<int> BB;
    5654  BB box1;
    57   check(box1.empty(), "It should be empty.");
     55  check(box1.empty(), "Wrong empty() in dim2::BoundingBox.");
    5856
    5957  box1.add(a);
    60   check(!box1.empty(), "It should not be empty.");
     58  check(!box1.empty(), "Wrong empty() in dim2::BoundingBox.");
    6159  box1.add(b);
    6260
     
    6563        box1.topRight().x==3 &&
    6664        box1.topRight().y==4,
    67         "Wrong addition of points to box.");
     65        "Wrong addition of points to dim2::BoundingBox.");
    6866
    6967  p.x=2; p.y=3;
    70   check(box1.inside(p), "It should be inside.");
     68  check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
    7169
    7270  p.x=1; p.y=3;
    73   check(box1.inside(p), "It should be inside.");
     71  check(box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
    7472
    7573  p.x=0; p.y=3;
    76   check(!box1.inside(p), "It should not be inside.");
     74  check(!box1.inside(p), "Wrong inside() in dim2::BoundingBox.");
    7775
    7876  BB box2(p);
    79   check(!box2.empty(),
    80         "It should not be empty. Constructed from 1 point.");
     77  check(!box2.empty(), "Wrong empty() in dim2::BoundingBox.");
    8178
    8279  box2.add(box1);
    83   check(box2.inside(p),
    84         "It should be inside. Incremented a box with another one.");
     80  check(box2.inside(p), "Wrong inside() in dim2::BoundingBox.");
    8581
    8682  return 0;
Note: See TracChangeset for help on using the changeset viewer.