author | athos |
Mon, 03 May 2004 14:43:49 +0000 | |
changeset 514 | fd991a24c857 |
parent 240 | 4a1d2e642552 |
permissions | -rw-r--r-- |
1 #include <xy.h>
2 #include <iostream>
3 using namespace std;
4 using namespace hugo;
6 bool passed = true;
8 void check(bool rc) {
9 passed = passed && rc;
10 if(!rc) {
11 cout << "Test failed!" << endl;
12 }
13 }
17 int main()
18 {
22 typedef xy<int> XY;
24 XY seged;
25 XY a(1,2);
26 XY b(3,4);
28 seged = a+b;
29 check(seged.x==4 && seged.y==6);
31 seged = a-b;
32 check(seged.x==-1 && seged.y==-1);
34 check(a.normSquare()==5);
35 check(a*b==11);
37 int l=2;
38 seged = a*l;
39 check(seged.x==2 && seged.y==4);
41 seged = b/l;
42 check(seged.x==1 && seged.y==2);
44 typedef BoundingBox<int> BB;
45 BB doboz1;
46 doboz1 += a;
47 doboz1 += b;
49 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
50 << endl;
52 return passed ? 0 : 1;
54 }