File size: 7,794 Bytes
68ce2fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-    */
/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */

/*

  Author(s):  Daniel Li, Anton Deguet
  Created on: 2006-07-10

  (C) Copyright 2006-2013 Johns Hopkins University (JHU), All Rights
  Reserved.

--- begin cisst license - do not edit ---

This software is provided "as is" under an open source license, with
no warranty.  The complete license can be found in license.txt and
http://www.cisst.org/cisst/license.txt.

--- end cisst license ---
*/


#include <cppunit/TestCase.h>
#include <cppunit/extensions/HelperMacros.h>

#include <cisstVector/vctForwardDeclarations.h>


class vctDynamicNArrayTest: public CppUnit::TestFixture
{
    CPPUNIT_TEST_SUITE(vctDynamicNArrayTest);

    CPPUNIT_TEST(TestAssignmentDouble);
    CPPUNIT_TEST(TestAssignmentFloat);
    CPPUNIT_TEST(TestAssignmentInt);

#if DANIEL
    CPPUNIT_TEST(TestAccessMethodsDouble);
    CPPUNIT_TEST(TestAccessMethodsFloat);
    CPPUNIT_TEST(TestAccessMethodsInt);
#endif  // DANIEL

    CPPUNIT_TEST(TestSoNiOperationsDouble);
    CPPUNIT_TEST(TestSoNiOperationsFloat);
    CPPUNIT_TEST(TestSoNiOperationsInt);

    CPPUNIT_TEST(TestSoNiNiOperationsDouble);
    CPPUNIT_TEST(TestSoNiNiOperationsFloat);
    CPPUNIT_TEST(TestSoNiNiOperationsInt);

    CPPUNIT_TEST(TestNioNiOperationsDouble);
    CPPUNIT_TEST(TestNioNiOperationsFloat);
    CPPUNIT_TEST(TestNioNiOperationsInt);

    CPPUNIT_TEST(TestNioSiNiOperationsDouble);
    CPPUNIT_TEST(TestNioSiNiOperationsFloat);
    CPPUNIT_TEST(TestNioSiNiOperationsInt);

    CPPUNIT_TEST(TestNioNiNiOperationsDouble);
    CPPUNIT_TEST(TestNioNiNiOperationsFloat);
    CPPUNIT_TEST(TestNioNiNiOperationsInt);

    CPPUNIT_TEST(TestNoNiNiOperationsDouble);
    CPPUNIT_TEST(TestNoNiNiOperationsFloat);
    CPPUNIT_TEST(TestNoNiNiOperationsInt);

    CPPUNIT_TEST(TestNoNiOperationsDouble);
    CPPUNIT_TEST(TestNoNiOperationsFloat);
    CPPUNIT_TEST(TestNoNiOperationsInt);

    CPPUNIT_TEST(TestNoNiSiOperationsDouble);
    CPPUNIT_TEST(TestNoNiSiOperationsFloat);
    CPPUNIT_TEST(TestNoNiSiOperationsInt);

    CPPUNIT_TEST(TestNoSiNiOperationsDouble);
    CPPUNIT_TEST(TestNoSiNiOperationsFloat);
    CPPUNIT_TEST(TestNoSiNiOperationsInt);

    CPPUNIT_TEST(TestNioSiOperationsDouble);
    CPPUNIT_TEST(TestNioSiOperationsFloat);
    CPPUNIT_TEST(TestNioSiOperationsInt);

    CPPUNIT_TEST(TestNioOperationsDouble);
    CPPUNIT_TEST(TestNioOperationsFloat);
    CPPUNIT_TEST(TestNioOperationsInt);

    CPPUNIT_TEST(TestSoNiSiOperationsDouble);
    CPPUNIT_TEST(TestSoNiSiOperationsFloat);
    CPPUNIT_TEST(TestSoNiSiOperationsInt);

    CPPUNIT_TEST(TestMinAndMaxDouble);
    CPPUNIT_TEST(TestMinAndMaxFloat);
    CPPUNIT_TEST(TestMinAndMaxInt);

    CPPUNIT_TEST(TestIteratorsDouble);
    CPPUNIT_TEST(TestIteratorsFloat);
    CPPUNIT_TEST(TestIteratorsInt);

    CPPUNIT_TEST(TestSTLFunctionsDouble);
    CPPUNIT_TEST(TestSTLFunctionsFloat);
    CPPUNIT_TEST(TestSTLFunctionsInt);

    CPPUNIT_TEST(TestIsCompactDouble);
    CPPUNIT_TEST(TestIsCompactFloat);
    CPPUNIT_TEST(TestIsCompactInt);

    CPPUNIT_TEST(TestFastCopyOfDouble);
    CPPUNIT_TEST(TestFastCopyOfFloat);
    CPPUNIT_TEST(TestFastCopyOfInt);

    CPPUNIT_TEST_SUITE_END();

 public:

    enum {MIN_DIM = 2, MAX_DIM = 6};
    enum {MIN_SIZE = 3, MAX_SIZE = 8};

    void setUp(void) {
    }

    void tearDown(void) {
    }

    typedef vct::size_type size_type;
    typedef vct::size_type dimension_type;
    typedef vct::stride_type stride_type;

    /*! Test assignments */
    template<class _elementType>
        void TestAssignment(void);
    void TestAssignmentDouble(void);
    void TestAssignmentFloat(void);
    void TestAssignmentInt(void);

#if DANIEL
    /*! Test access methods */
    template<class _elementType>
        void TestAccessMethods(void);
    void TestAccessMethodsDouble(void);
    void TestAccessMethodsFloat(void);
    void TestAccessMethodsInt(void);
#endif  // DANIEL

    /*! Test SoNi operations */
    template<class _elementType>
        void TestSoNiOperations(void);
    void TestSoNiOperationsDouble(void);
    void TestSoNiOperationsFloat(void);
    void TestSoNiOperationsInt(void);

    /*! Test SoNiNi operations */
    template<class _elementType>
        void TestSoNiNiOperations(void);
    void TestSoNiNiOperationsDouble(void);
    void TestSoNiNiOperationsFloat(void);
    void TestSoNiNiOperationsInt(void);

    /*! Test NioNi operations */
    template<class _elementType>
        void TestNioNiOperations(void);
    void TestNioNiOperationsDouble(void);
    void TestNioNiOperationsFloat(void);
    void TestNioNiOperationsInt(void);

    /*! Test NioSiNi operations */
    template<class _elementType>
        void TestNioSiNiOperations(void);
    void TestNioSiNiOperationsDouble(void);
    void TestNioSiNiOperationsFloat(void);
    void TestNioSiNiOperationsInt(void);

    /*! Test NioNiNi operations */
    template<class _elementType>
        void TestNioNiNiOperations(void);
    void TestNioNiNiOperationsDouble(void);
    void TestNioNiNiOperationsFloat(void);
    void TestNioNiNiOperationsInt(void);

    /*! Test NoNiNi operations */
    template<class _elementType>
        void TestNoNiNiOperations(void);
    void TestNoNiNiOperationsDouble(void);
    void TestNoNiNiOperationsFloat(void);
    void TestNoNiNiOperationsInt(void);

    /*! Test NoNi operations */
    template<class _elementType>
        void TestNoNiOperations(void);
    void TestNoNiOperationsDouble(void);
    void TestNoNiOperationsFloat(void);
    void TestNoNiOperationsInt(void);

    /*! Test NoNiSi operations */
    template<class _elementType>
        void TestNoNiSiOperations(void);
    void TestNoNiSiOperationsDouble(void);
    void TestNoNiSiOperationsFloat(void);
    void TestNoNiSiOperationsInt(void);

    /*! Test NoSiNi operations */
    template<class _elementType>
        void TestNoSiNiOperations(void);
    void TestNoSiNiOperationsDouble(void);
    void TestNoSiNiOperationsFloat(void);
    void TestNoSiNiOperationsInt(void);

    /*! Test NioSi operations */
    template<class _elementType>
        void TestNioSiOperations(void);
    void TestNioSiOperationsDouble(void);
    void TestNioSiOperationsFloat(void);
    void TestNioSiOperationsInt(void);

    /*! Test Nio operations */
    template<class _elementType>
        void TestNioOperations(void);
    void TestNioOperationsDouble(void);
    void TestNioOperationsFloat(void);
    void TestNioOperationsInt(void);

    /*! Test SoNiSi operations */
    template<class _elementType>
        void TestSoNiSiOperations(void);
    void TestSoNiSiOperationsDouble(void);
    void TestSoNiSiOperationsFloat(void);
    void TestSoNiSiOperationsInt(void);

    /*! Test MinAndMax */
    template<class _elementType>
        void TestMinAndMax(void);
    void TestMinAndMaxDouble(void);
    void TestMinAndMaxFloat();
    void TestMinAndMaxInt(void);

    /*! Test iterators */
    template<class _elementType>
        void TestIterators(void);
    void TestIteratorsDouble(void);
    void TestIteratorsFloat(void);
    void TestIteratorsInt(void);

    /*! Test STL functions */
    template<class _elementType>
        void TestSTLFunctions(void);
    void TestSTLFunctionsDouble(void);
    void TestSTLFunctionsFloat(void);
    void TestSTLFunctionsInt(void);

    /*! Test IsCompact */
    template<class _elementType>
        void TestIsCompact(void);
    void TestIsCompactDouble(void);
    void TestIsCompactFloat(void);
    void TestIsCompactInt(void);

    /*! Test FastCopyOf */
    template<class _elementType>
        void TestFastCopyOf(void);
    void TestFastCopyOfDouble(void);
    void TestFastCopyOfFloat(void);
    void TestFastCopyOfInt(void);

};