1.1 --- a/src/test/xy_test.cc Thu Jul 22 14:19:23 2004 +0000
1.2 +++ b/src/test/xy_test.cc Thu Jul 22 14:21:46 2004 +0000
1.3 @@ -1,21 +1,9 @@
1.4 #include <hugo/xy.h>
1.5 #include <iostream>
1.6 +#include "test_tools.h"
1.7 +
1.8 using namespace std;
1.9 using namespace hugo;
1.10 -
1.11 -bool passed = true;
1.12 -
1.13 -void check(bool rc, char *msg="") {
1.14 - passed = passed && rc;
1.15 - if(!rc) {
1.16 - std::cerr << "Test failed! ("<< msg << ")" << std::endl; \
1.17 -
1.18 -
1.19 - }
1.20 -}
1.21 -
1.22 -
1.23 -
1.24 int main()
1.25 {
1.26
1.27 @@ -28,12 +16,12 @@
1.28 XY b(3,4);
1.29
1.30 seged = a+b;
1.31 - check(seged.x==4 && seged.y==6);
1.32 + check(seged.x==4 && seged.y==6, "Wrong vector addition");
1.33
1.34 seged = a-b;
1.35 check(seged.x==-2 && seged.y==-2, "a-b");
1.36
1.37 - check(a.normSquare()==5);
1.38 + check(a.normSquare()==5,"Wrong norm calculation");
1.39 check(a*b==11, "a*b");
1.40
1.41 int l=2;
1.42 @@ -58,23 +46,19 @@
1.43 "added points to box");
1.44
1.45 seged.x=2;seged.y=3;
1.46 - check(doboz1.inside(seged),"Inside? Should be.");
1.47 + check(doboz1.inside(seged),"Inside? It should be.");
1.48
1.49 seged.x=1;seged.y=3;
1.50 - check(doboz1.inside(seged),"Inside? Should be.");
1.51 + check(doboz1.inside(seged),"Inside? It should be.");
1.52
1.53 seged.x=0;seged.y=3;
1.54 - check(!doboz1.inside(seged),"Inside? Should not be.");
1.55 + check(!doboz1.inside(seged),"Inside? It should not be.");
1.56
1.57 BB doboz2(seged);
1.58 - check(!doboz2.empty(), "empty? Should not be. Constructed from 1 point.");
1.59 + check(!doboz2.empty(),
1.60 + "empty? Should not be. Constructed from 1 point.");
1.61
1.62 doboz2 += doboz1;
1.63 - check(doboz2.inside(seged),"Inside? Should be. Incremented a box with an other.");
1.64 -
1.65 - cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
1.66 - << endl;
1.67 -
1.68 - return passed ? 0 : 1;
1.69 -
1.70 + check(doboz2.inside(seged),
1.71 + "Not inside? It should be. Incremented a box with an other.");
1.72 }