testSparseMatrixVectorSMatrixSVector.cc
Go to the documentation of this file.
1 
11 #include <iostream>
12 
13 #include <utl/SVector.h>
14 #include <utl/SMatrix.h>
15 #include <utl/SparseVector.h>
16 #include <utl/SparseMatrix.h>
17 
18 #include <tst/Verify.h>
19 #include <cppunit/extensions/HelperMacros.h>
20 
21 using namespace std;
22 using namespace utl;
23 using namespace tst;
24 
25 #define ASSERT_CLOSE(x, y) CPPUNIT_ASSERT(Verify<CloseTo>(x, y))
26 #define ASSERT_CLOSE_EPS(x, y, eps) CPPUNIT_ASSERT(Verify<CloseTo>(x, y, eps))
27 #define ASSERT_EQUAL(x, y) CPPUNIT_ASSERT(Verify<Equal>(x, y))
28 
29 
33 class TestSparseMatrixVectorSMatrixSVector : public CppUnit::TestFixture {
34 
35  CPPUNIT_TEST_SUITE(TestSparseMatrixVectorSMatrixSVector);
36  CPPUNIT_TEST(TestCrossCtor);
37  CPPUNIT_TEST_SUITE_END();
38 
39 public:
40  void
42  {
44  v(0) = 1; v(5) = 2; v(100) = 3;
45 
46  SVector<10> sv(v);
47 
48  for (int i = 0; i < 10; ++i)
49  ASSERT_EQUAL(sv[i], v[i]);
50 
52  m(0, 0) = 1; m(2, 3) = 2; m(5, 1) = 3; m(9, 9) = 4; m(20, 1) = 5;
53 
54  SMatrix<10, 10> sm(m);
55 
56  for (int i = 0; i < 10; ++i)
57  for (int j = 0; j < 10; ++j)
58  ASSERT_EQUAL(sm[i][j], m[i][j]);
59  }
60 
61 };
62 
63 
65 
66 
67 // Configure (x)emacs for this file ...
68 // Local Variables:
69 // mode: c++
70 // End:
Sparse container class for vectorial data.
Definition: SparseVector.h:36
Sparse container class for matrix data.
Definition: SparseMatrix.h:36
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Static (small and dense) vector class.
Definition: SVector.h:33
constexpr double m
Definition: AugerUnits.h:121
#define ASSERT_EQUAL(x, y)
Static (small and dense) matrix class.
Definition: SMatrix.h:23

, generated on Tue Sep 26 2023.