1.1 --- a/src/test/xy_test.cc Sat May 21 21:04:57 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,80 +0,0 @@
1.4 -/* -*- C++ -*-
1.5 - * src/test/xy_test.cc - Part of LEMON, a generic C++ optimization library
1.6 - *
1.7 - * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.8 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.9 - *
1.10 - * Permission to use, modify and distribute this software is granted
1.11 - * provided that this copyright notice appears in all copies. For
1.12 - * precise terms see the accompanying LICENSE file.
1.13 - *
1.14 - * This software is provided "AS IS" with no warranty of any kind,
1.15 - * express or implied, and with no claim as to its suitability for any
1.16 - * purpose.
1.17 - *
1.18 - */
1.19 -
1.20 -#include <lemon/xy.h>
1.21 -#include <iostream>
1.22 -#include "test_tools.h"
1.23 -
1.24 -using namespace std;
1.25 -using namespace lemon;
1.26 -int main()
1.27 -{
1.28 -
1.29 - cout << "Testing classes `xy' and `boundingbox'." << endl;
1.30 -
1.31 - typedef xy<int> XY;
1.32 -
1.33 - XY seged;
1.34 - XY a(1,2);
1.35 - XY b(3,4);
1.36 -
1.37 - seged = a+b;
1.38 - check(seged.x==4 && seged.y==6, "Wrong vector addition");
1.39 -
1.40 - seged = a-b;
1.41 - check(seged.x==-2 && seged.y==-2, "a-b");
1.42 -
1.43 - check(a.normSquare()==5,"Wrong norm calculation");
1.44 - check(a*b==11, "a*b");
1.45 -
1.46 - int l=2;
1.47 - seged = a*l;
1.48 - check(seged.x==2 && seged.y==4, "a*l");
1.49 -
1.50 - seged = b/l;
1.51 - check(seged.x==1 && seged.y==2, "b/l");
1.52 -
1.53 - typedef BoundingBox<int> BB;
1.54 - BB doboz1;
1.55 - check(doboz1.empty(), "It should be empty.");
1.56 -
1.57 - doboz1 += a;
1.58 - check(!doboz1.empty(), "It should not be empty.");
1.59 - doboz1 += b;
1.60 -
1.61 - check(doboz1.bottomLeft().x==1 &&
1.62 - doboz1.bottomLeft().y==2 &&
1.63 - doboz1.topRight().x==3 &&
1.64 - doboz1.topRight().y==4,
1.65 - "added points to box");
1.66 -
1.67 - seged.x=2;seged.y=3;
1.68 - check(doboz1.inside(seged),"It should be inside.");
1.69 -
1.70 - seged.x=1;seged.y=3;
1.71 - check(doboz1.inside(seged),"It should be inside.");
1.72 -
1.73 - seged.x=0;seged.y=3;
1.74 - check(!doboz1.inside(seged),"It should not be inside.");
1.75 -
1.76 - BB doboz2(seged);
1.77 - check(!doboz2.empty(),
1.78 - "It should not be empty. Constructed from 1 point.");
1.79 -
1.80 - doboz2 += doboz1;
1.81 - check(doboz2.inside(seged),
1.82 - "It should be inside. Incremented a box with an other.");
1.83 -}