test/dim_test.cc
changeset 2207 75a29ac69c19
parent 2006 00d59f733817
child 2212 0ad3835449f8
equal deleted inserted replaced
4:c63430488ea2 0:3d73cb4dd801
    14  * express or implied, and with no claim as to its suitability for any
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    15  * purpose.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 #include <lemon/xy.h>
    19 #include <lemon/dim2.h>
    20 #include <iostream>
    20 #include <iostream>
    21 #include "test_tools.h"
    21 #include "test_tools.h"
    22 
    22 
    23 using namespace std;
    23 using namespace std;
    24 using namespace lemon;
    24 using namespace lemon;
    25 int main()
    25 int main()
    26 {
    26 {
    27 
    27 
    28   cout << "Testing classes `xy' and `boundingbox'." << endl;
    28   cout << "Testing classes `dim2::Point' and `dim2::BoundingBox'." << endl;
    29 
    29 
    30 	typedef xy<int> XY;
    30   typedef dim2::Point<int> Point;
    31 	
    31 	
    32 	XY seged;
    32 	Point seged;
    33 	XY a(1,2);
    33 	Point a(1,2);
    34 	XY b(3,4);
    34 	Point b(3,4);
    35 
    35 
    36 	seged = a+b;
    36 	seged = a+b;
    37 	check(seged.x==4 && seged.y==6, "Wrong vector addition");
    37 	check(seged.x==4 && seged.y==6, "Wrong vector addition");
    38 
    38 
    39 	seged = a-b;
    39 	seged = a-b;
    47 	check(seged.x==2 && seged.y==4, "a*l");
    47 	check(seged.x==2 && seged.y==4, "a*l");
    48 
    48 
    49 	seged = b/l;
    49 	seged = b/l;
    50 	check(seged.x==1 && seged.y==2, "b/l");
    50 	check(seged.x==1 && seged.y==2, "b/l");
    51 
    51 
    52 	typedef BoundingBox<int> BB;
    52 	typedef dim2::BoundingBox<int> BB;
    53 	BB doboz1;
    53 	BB doboz1;
    54 	check(doboz1.empty(), "It should be empty.");
    54 	check(doboz1.empty(), "It should be empty.");
    55 	
    55 	
    56 	doboz1.add(a);
    56 	doboz1.add(a);
    57 	check(!doboz1.empty(), "It should not be empty.");
    57 	check(!doboz1.empty(), "It should not be empty.");