13 #include <utl/SVector.h>
14 #include <utl/SMatrix.h>
16 #include <tst/Verify.h>
17 #include <cppunit/extensions/HelperMacros.h>
23 #define ASSERT_CLOSE(x, y) CPPUNIT_ASSERT(Verify<CloseTo>(x, y))
24 #define ASSERT_CLOSE_EPS(x, y, eps) CPPUNIT_ASSERT(Verify<CloseTo>(x, y, eps))
25 #define ASSERT_EQUAL(x, y) CPPUNIT_ASSERT(Verify<Equal>(x, y))
30 Foo(
const int off = 0) : fOffset(off) { }
32 int operator[](
const unsigned int i)
const {
return 2*int(i) + fOffset; }
51 CPPUNIT_TEST(TestSVectorCtor);
52 CPPUNIT_TEST(TestSVectorOp);
53 CPPUNIT_TEST(TestSVectorAngle);
54 CPPUNIT_TEST(TestSVectorListAssignment);
55 CPPUNIT_TEST(TestSVectorIterators);
56 CPPUNIT_TEST(TestSMatrixCtor);
57 CPPUNIT_TEST(TestSMatrixOp);
59 CPPUNIT_TEST(TestSMatrixListAssignment);
60 CPPUNIT_TEST(TestSVectorNontrivialTypes);
61 CPPUNIT_TEST_SUITE_END();
76 for (
unsigned int i = 0; i < v1.
GetSize(); ++i)
85 const int v1value = 1;
88 for (
unsigned int i = 0; i < v1.
GetSize(); ++i)
92 const int v2value = 13;
95 for (
unsigned int i = 0; i < v2.
GetSize(); ++i)
108 for (
unsigned int i = 0; i < v3.
GetSize(); ++i)
112 const int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
116 for (
unsigned int i = 0; i < v4.
GetSize(); ++i)
121 for (
unsigned int i = 0; i < v41.
GetSize(); ++i)
125 const int*
const pa = &(a[0]);
129 for (
unsigned int i = 0; i < v5.
GetSize(); ++i)
135 for (
unsigned int i = 0; i < v6.
GetSize(); ++i)
141 for (
unsigned int i = 0; i < v7.
GetSize(); ++i)
152 for (
unsigned int i = 0; i < v1.
GetSize(); ++i)
159 for (
unsigned int i = 0; i < v2.
GetSize(); ++i)
166 for (
unsigned int i = 0; i < v2.
GetSize(); ++i)
172 for (
unsigned int i = 0; i < v3.
GetSize(); ++i) {
177 const double dot = v3 * v4;
183 for (
unsigned int i = 0; i < v5.
GetSize(); ++i)
188 for (
unsigned int i = 0; i < v5.
GetSize(); ++i)
195 const double eps = 1e-8;
203 v3 = -1., -1., -1.+
eps;
215 for (
unsigned int i = 0; i < v.
GetSize(); ++i)
223 for (
unsigned int i = 0; i < 3; ++i)
225 for (
unsigned int i = 3; i < v.
GetSize(); ++i)
232 for (
unsigned int i = 0; i < 3; ++i)
234 for (
unsigned int i = 3; i < v.
GetSize(); ++i)
244 for (
unsigned int i = 0; i < 3; ++i)
245 for (
unsigned int j = 0; j < m[0].
GetSize(); ++j)
247 for (
unsigned int i = 3; i < v.GetSize(); ++i)
248 for (
unsigned int j = 0; j < m[0].
GetSize(); ++j)
259 for (
int i = 0; i < n; ++i)
262 for (SVNI::Iterator it = v.Begin(); it != v.End(); ++it) {
267 for (SVNI::ConstIterator it = v.Begin(); it != v.End(); ++it) {
288 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
301 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
308 const int value = 13;
311 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
324 for (
unsigned int i = 0; i < md.
GetNRows(); ++i)
325 for (
unsigned int j = 0; j < md.
GetNColumns(); ++j)
334 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
352 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
362 for (
unsigned int i = 0; i < md.
GetNRows(); ++i)
363 for (
unsigned int j = 0; j < md.
GetNColumns(); ++j)
370 for (
unsigned int i = 0; i < m2.
GetNRows(); ++i)
371 for (
unsigned int j = 0; j < m2.
GetNColumns(); ++j)
376 int** ma =
new int*[10];
378 for (
unsigned int i = 0; i < 10; ++i) {
379 ma[i] =
new int[100];
380 for (
unsigned int j = 0; j < 100; ++j)
387 for (
unsigned int i = 0; i < 10; ++i)
388 for (
unsigned int j = 0; j < 100; j++)
391 for (
unsigned int i = 0; i < 10; ++i)
404 for (
unsigned int i = 0; i < m1.
GetNRows(); ++i)
405 for (
unsigned int j = 0; j < m1.
GetNColumns(); ++j)
412 for (
unsigned int i = 0; i < m2.
GetNRows(); ++i)
413 for (
unsigned int j = 0; j < m2.
GetNColumns(); ++j)
420 for (
unsigned int i = 0; i < m2.
GetNRows(); ++i)
421 for (
unsigned int j = 0; j < m2.
GetNColumns(); ++j)
425 const unsigned int n = 100;
426 const unsigned int m = 50;
430 for (
unsigned int i = 0; i < m3.
GetNRows(); ++i)
431 for (
unsigned int j = 0; j < m3.
GetNColumns(); ++j) {
433 m4[j][i] = -2 * int(i) + int(j);
441 for (
unsigned int i = 0; i < prod.
GetNRows(); ++i)
442 for (
unsigned int j = 0; j < prod.
GetNColumns(); ++j) {
447 double(-2*m*ii*jj+(ii-2*jj)*(m-1)*m/2+(m-1)*m*(2*m-1)/6)
499 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
507 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
508 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
509 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
510 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
511 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
512 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
513 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
514 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
515 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
516 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
517 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
518 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
519 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
520 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
521 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
522 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
523 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
524 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
525 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
526 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260,
527 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273;
529 for (
unsigned int i = 0; i < m.
GetNRows(); ++i)
545 const double partialDot = v1[0] * v2[0];
549 const double dot = v1 * v2;
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
void TestSMatrixListAssignment()
#define ASSERT_CLOSE(x, y)
Static (small and dense) vector class.
static std::size_t GetSize()
Foo operator[](const unsigned int i) const
#define ASSERT_EQUAL(x, y)
void TestSVectorListAssignment()
void TestSVectorNontrivialTypes()
void TestSVectorIterators()
double CosAngle(const Vector &l, const Vector &r)
int operator[](const unsigned int i) const
static unsigned int GetNRows()
static unsigned int GetNColumns()
Static (small and dense) matrix class.