Subversion Repositories gelsvn

Rev

Rev 39 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 39 Rev 53
Line 15... Line 15...
15
#include "CGLA/Vec3usi.h"
15
#include "CGLA/Vec3usi.h"
16
#include "CGLA/Vec4f.h"
16
#include "CGLA/Vec4f.h"
17
#include "CGLA/Vec4d.h"
17
#include "CGLA/Vec4d.h"
18
#include "CGLA/Vec4uc.h"
18
#include "CGLA/Vec4uc.h"
19
#include "CGLA/Quaternion.h"
19
#include "CGLA/Quaternion.h"
20
#include "Timer.h"
20
#include "Util/Timer.h"
21
 
21
 
22
using namespace std;
22
using namespace std;
23
using namespace CGLA;
23
using namespace CGLA;
-
 
24
using namespace Util;
24
 
25
 
25
namespace
26
namespace
26
{
27
{
27
  // To find a pseudo-random number in the interval [0,1[
28
  // To find a pseudo-random number in the interval [0,1[
28
  double my_random()
29
  double my_random()
Line 88... Line 89...
88
    success += x1[0] == xi1 && x1[1] == xi2;
89
    success += x1[0] == xi1 && x1[1] == xi2;
89
 
90
 
90
    success += x1.get() == &x1[0];
91
    success += x1.get() == &x1[0];
91
 
92
 
92
    double temp = BIG;
93
    double temp = BIG;
93
    for(int i = 0; i < x1.get_dim(); ++i)
94
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
94
      if(x1[i] < temp)
95
      if(x1[i] < temp)
95
	temp = x1[i];
96
	temp = x1[i];
96
    success += temp == x1.min_coord();
97
    success += temp == x1.min_coord();
97
 
98
 
98
    temp = -BIG;
99
    temp = -BIG;
99
    for(int i = 0; i < x1.get_dim(); ++i)
100
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
100
      if(x1[i] > temp)
101
      if(x1[i] > temp)
101
	temp = x1[i];
102
	temp = x1[i];
102
    success += temp == x1.max_coord();
103
    success += temp == x1.max_coord();
103
  }
104
  }
104
  if(success != 5)
105
  if(success != 5)
Line 393... Line 394...
393
    success += x1[0] == xi1 && x1[1] == xi2;
394
    success += x1[0] == xi1 && x1[1] == xi2;
394
 
395
 
395
    success += x1.get() == &x1[0];
396
    success += x1.get() == &x1[0];
396
 
397
 
397
    float temp = BIG;
398
    float temp = BIG;
398
    for(int i = 0; i < x1.get_dim(); ++i)
399
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
399
      if(x1[i] < temp)
400
      if(x1[i] < temp)
400
	temp = x1[i];
401
	temp = x1[i];
401
    success += temp == x1.min_coord();
402
    success += temp == x1.min_coord();
402
 
403
 
403
    temp = -BIG;
404
    temp = -BIG;
404
    for(int i = 0; i < x1.get_dim(); ++i)
405
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
405
      if(x1[i] > temp)
406
      if(x1[i] > temp)
406
	temp = x1[i];
407
	temp = x1[i];
407
    success += temp == x1.max_coord();
408
    success += temp == x1.max_coord();
408
  }
409
  }
409
  if(success != 5)
410
  if(success != 5)
Line 707... Line 708...
707
    success += x1[0] == xi1 && x1[1] == xi2;
708
    success += x1[0] == xi1 && x1[1] == xi2;
708
 
709
 
709
    success += x1.get() == &x1[0];
710
    success += x1.get() == &x1[0];
710
 
711
 
711
    int temp = INT_MAX;
712
    int temp = INT_MAX;
712
    for(int i = 0; i < x1.get_dim(); ++i)
713
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
713
      if(x1[i] < temp)
714
      if(x1[i] < temp)
714
	temp = x1[i];
715
	temp = x1[i];
715
    success += temp == x1.min_coord();
716
    success += temp == x1.min_coord();
716
 
717
 
717
    temp = -INT_MAX;
718
    temp = -INT_MAX;
718
    for(int i = 0; i < x1.get_dim(); ++i)
719
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
719
      if(x1[i] > temp)
720
      if(x1[i] > temp)
720
	temp = x1[i];
721
	temp = x1[i];
721
    success += temp == x1.max_coord();
722
    success += temp == x1.max_coord();
722
  }
723
  }
723
  if(success != 5)
724
  if(success != 5)
Line 993... Line 994...
993
    success += x1[0] == xi1 && x1[1] == xi2 && x1[2] == xi3;
994
    success += x1[0] == xi1 && x1[1] == xi2 && x1[2] == xi3;
994
 
995
 
995
    success += x1.get() == &x1[0];
996
    success += x1.get() == &x1[0];
996
 
997
 
997
    int temp = INT_MAX;
998
    int temp = INT_MAX;
998
    for(int i = 0; i < x1.get_dim(); ++i)
999
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
999
      if(x1[i] < temp)
1000
      if(x1[i] < temp)
1000
	temp = x1[i];
1001
	temp = x1[i];
1001
    success += temp == x1.min_coord();
1002
    success += temp == x1.min_coord();
1002
 
1003
 
1003
    temp = -INT_MAX;
1004
    temp = -INT_MAX;
1004
    for(int i = 0; i < x1.get_dim(); ++i)
1005
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
1005
      if(x1[i] > temp)
1006
      if(x1[i] > temp)
1006
	temp = x1[i];
1007
	temp = x1[i];
1007
    success += temp == x1.max_coord();
1008
    success += temp == x1.max_coord();
1008
  }
1009
  }
1009
  if(success != 5)
1010
  if(success != 5)
Line 1278... Line 1279...
1278
    success += x1[0] == xi1 && x1[1] == xi2 && x1[2] == xi3;
1279
    success += x1[0] == xi1 && x1[1] == xi2 && x1[2] == xi3;
1279
 
1280
 
1280
    success += x1.get() == &x1[0];
1281
    success += x1.get() == &x1[0];
1281
 
1282
 
1282
    float temp = BIG;
1283
    float temp = BIG;
1283
    for(float i = 0; i < x1.get_dim(); ++i)
1284
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
1284
      if(x1[i] < temp)
1285
      if(x1[i] < temp)
1285
	temp = x1[i];
1286
	temp = x1[i];
1286
    success += temp == x1.min_coord();
1287
    success += temp == x1.min_coord();
1287
 
1288
 
1288
    temp = -BIG;
1289
    temp = -BIG;
1289
    for(float i = 0; i < x1.get_dim(); ++i)
1290
    for(unsigned int i = 0; i < x1.get_dim(); ++i)
1290
      if(x1[i] > temp)
1291
      if(x1[i] > temp)
1291
	temp = x1[i];
1292
	temp = x1[i];
1292
    success += temp == x1.max_coord();
1293
    success += temp == x1.max_coord();
1293
  }
1294
  }
1294
  if(success != 5)
1295
  if(success != 5)
Line 1860... Line 1861...
1860
 
1861
 
1861
  ////////////////////////////////////////////////
1862
  ////////////////////////////////////////////////
1862
  //              F I N A L I Z E
1863
  //              F I N A L I Z E
1863
  ////////////////////////////////////////////////
1864
  ////////////////////////////////////////////////
1864
 
1865
 
1865
  t.stop();
-
 
1866
 
-
 
1867
  cout << "Performance time: " << t.get_time();
1866
  cout << "Performance time: " << t.get_secs();
1868
  cout << endl << "ArithVec and derived vector classes have been tested successfully";
1867
  cout << endl << "ArithVec and derived vector classes have been tested successfully";
1869
 
1868
 
1870
  return 0;
1869
  return 0;
1871
}
1870
}