Rel.07 NEWS - 2. round
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #include <lemon/dim2.h>
21 #include "test_tools.h"
24 using namespace lemon;
28 cout << "Testing classes 'dim2::Point' and 'dim2::BoundingBox'." << endl;
30 typedef dim2::Point<int> Point;
33 check(p.size()==2, "Wrong vector initialization.");
37 check(a[0]==1 && a[1]==2, "Wrong vector initialization.");
40 check(p.x==4 && p.y==6, "Wrong vector addition.");
43 check(p.x==-2 && p.y==-2, "Wrong vector subtraction.");
45 check(a.normSquare()==5,"Wrong vector norm calculation.");
46 check(a*b==11, "Wrong vector scalar product.");
50 check(p.x==2 && p.y==4, "Wrong vector multiplication by a scalar.");
53 check(p.x==1 && p.y==2, "Wrong vector division by a scalar.");
55 typedef dim2::BoundingBox<int> BB;
57 check(box1.empty(), "It should be empty.");
60 check(!box1.empty(), "It should not be empty.");
63 check(box1.bottomLeft().x==1 &&
64 box1.bottomLeft().y==2 &&
65 box1.topRight().x==3 &&
67 "Wrong addition of points to box.");
70 check(box1.inside(p), "It should be inside.");
73 check(box1.inside(p), "It should be inside.");
76 check(!box1.inside(p), "It should not be inside.");
80 "It should not be empty. Constructed from 1 point.");
84 "It should be inside. Incremented a box with another one.");