25 #ifndef WTENSOR_TEST_H
26 #define WTENSOR_TEST_H
31 #include <cxxtest/TestSuite.h>
32 #include "../WTensor.h"
55 TS_ASSERT_EQUALS( w( 0, 0, 0 ), 2 );
56 TS_ASSERT_EQUALS( w( 0, 0, 1 ), 3 );
57 TS_ASSERT_EQUALS( w( 0, 1, 0 ), 0 );
58 TS_ASSERT_EQUALS( w( 0, 1, 1 ), 5 );
59 TS_ASSERT_EQUALS( w( 1, 0, 0 ), 2 );
60 TS_ASSERT_EQUALS( w( 1, 0, 1 ), 1 );
61 TS_ASSERT_EQUALS( w( 1, 1, 0 ), 8 );
62 TS_ASSERT_EQUALS( w( 1, 1, 1 ), 10 );
70 std::vector< unsigned int > v( 3, 0 );
73 for( v[ 0 ] = 0; v[ 0 ] < 4; ++v[ 0 ] )
75 for( v[ 1 ] = 0; v[ 1 ] < 4; ++v[ 1 ] )
77 for( v[ 2 ] = 0; v[ 2 ] < 4; ++v[ 2 ] )
79 w[ v ] = v[ 0 ] + v[ 1 ] + v[ 2 ];
84 unsigned int f[] = { 0, 0, 0 };
85 for( f[ 0 ] = 0; f[ 0 ] < 4; ++f[ 0 ] )
87 for( f[ 1 ] = 0; f[ 1 ] < 4; ++f[ 1 ] )
89 for( f[ 2 ] = 0; f[ 2 ] < 4; ++f[ 2 ] )
91 TS_ASSERT_EQUALS( w[ f ], f[ 0 ] + f[ 1 ] + f[ 2 ] );
127 TS_ASSERT_EQUALS( t35d( 0, 4, 2 ), 0.0 );
128 TS_ASSERT_EQUALS( t35d( 1, 4, 0 ), 0.0 );
129 TS_ASSERT_EQUALS( t35d( 0, 3, 0 ), 0.0 );
130 TS_ASSERT_EQUALS( t35d( 2, 4, 1 ), 0.0 );
131 TS_ASSERT_EQUALS( t35d( 0, 2, 2 ), 0.0 );
132 TS_ASSERT_EQUALS( t35d( 4, 1, 4 ), 0.0 );
133 TS_ASSERT_EQUALS( t35d( 4, 4, 4 ), 0.0 );
134 TS_ASSERT_EQUALS( t35d( 3, 4, 3 ), 0.0 );
136 TS_ASSERT_EQUALS( t11d( 0 ), 0.0 );
137 TS_ASSERT_EQUALS( t22d( 0, 1 ), 0.0 );
150 TS_ASSERT_EQUALS( m( 0, 1 ), 2 );
151 TS_ASSERT_EQUALS( m( 2, 1 ), 0.456 );
160 w( 0, 0, 1, 1, 0, 1 ) = 4.0;
161 w( 1, 1, 0, 0, 0, 0 ) = 0.56;
166 TS_ASSERT_EQUALS( m( 0, 0, 1, 1, 0, 1 ), 4.0 );
167 TS_ASSERT_EQUALS( m( 1, 1, 0, 0, 0, 0 ), 0.56 );
168 TS_ASSERT_EQUALS( m( 0, 0, 0, 1, 0, 0 ), 0.0 );
184 TS_ASSERT_EQUALS( t( 1, 2, 0 ), 2.0 );
191 TS_ASSERT_EQUALS( w( 0, 0, 0 ), 0.0 );
192 TS_ASSERT_EQUALS( w( 0, 2, 1 ), 2.0 );
201 TS_ASSERT_EQUALS( t( 2 ), 2.0 );
208 TS_ASSERT_EQUALS( w( 0 ), 0.0 );
209 TS_ASSERT_EQUALS( w( 2 ), 2.0 );
218 TS_ASSERT_EQUALS( t(), 2.0 );
225 TS_ASSERT_EQUALS( w(), 2.0 );
242 TS_ASSERT_EQUALS( d, 3.0 );
249 TS_ASSERT_EQUALS( v[ 0 ], 3.0 );
256 TS_ASSERT_EQUALS( m( 0, 1 ), 3.0 );
261 #endif // WTENSOR_TEST_H
Implements a symmetric tensor that has the same number of components in every direction.
void testCastToVariousTypes()
Test casts to Data_T, WValue or WMatrix, depending on the order of the Tensor.
void testCopyOperator()
Test copy operator.
Base class for all higher level values like tensors, vectors, matrices and so on. ...
Matrix template class with variable number of rows and columns.
void testCopyConstructor()
Test copy constructor.
void testAccessOperator2()
Test access operator [].
Implements a tensor that has the same number of components in every direction.
Test class for the WTensor template.
void testAccessOperator1()
Test access operator ().
void testCopyFromTensorSym()
Test if all the WTensorSym->WTensor copy operators and copy constructors compile. ...
void testStandardConstructor()
Test the standard constructor.