0024240: Separation of header files for QANCollection into hxx and cxx
[occt.git] / src / QANCollection / QANCollection_Test.cxx
CommitLineData
3a01a933 1// Created on: 2004-03-05
2// Created by: Mikhail KUZMITCHEV
3// Copyright (c) 2004-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#include <QANCollection.hxx>
17#include <QANCollection_Common.hxx>
18
19#include <Draw.hxx>
20#include <Draw_Interpretor.hxx>
21
22#include <gp_Pnt.hxx>
23
24#define ItemType gp_Pnt
25#define Key1Type Standard_Real
26#define Key2Type Standard_Integer
27
28#include <NCollection_DefineArray1.hxx>
29#include <NCollection_DefineHArray1.hxx>
30////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
31////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
32DEFINE_ARRAY1(QANCollection_Array1Func,QANCollection_BaseColFunc,ItemType)
33DEFINE_HARRAY1(QANCollection_HArray1Func,QANCollection_Array1Func)
34IMPLEMENT_HARRAY1(QANCollection_HArray1Func)
35
36#include <NCollection_DefineArray2.hxx>
37#include <NCollection_DefineHArray2.hxx>
38////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
39////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
40DEFINE_ARRAY2(QANCollection_Array2Func,QANCollection_BaseColFunc,ItemType)
41DEFINE_HARRAY2(QANCollection_HArray2Func,QANCollection_Array2Func)
42IMPLEMENT_HARRAY2(QANCollection_HArray2Func)
43
44#include <NCollection_DefineMap.hxx>
45#include <NCollection_DefineDataMap.hxx>
46#include <NCollection_DefineDoubleMap.hxx>
47#include <NCollection_DefineIndexedMap.hxx>
48#include <NCollection_DefineIndexedDataMap.hxx>
49////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
50////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
51////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
52////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
53////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
54DEFINE_MAP(QANCollection_MapFunc,QANCollection_Key1BaseColFunc,Key1Type)
55DEFINE_DATAMAP(QANCollection_DataMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
56DEFINE_DOUBLEMAP(QANCollection_DoubleMapFunc,QANCollection_Key2BaseColFunc,Key1Type,Key2Type)
57DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key1Type)
58DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
59
60#include <NCollection_DefineList.hxx>
61////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
62DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
63
64#include <NCollection_DefineSequence.hxx>
65#include <NCollection_DefineHSequence.hxx>
66////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
67////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
68DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
69DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
70IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc)
71
72// HashCode and IsEquel must be defined for key types of maps
73Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper)
74{
75 return HashCode(thePnt.X(),theUpper);
76}
77
78Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2)
79{
80 return theP1.IsEqual(theP2,gp::Resolution());
81}
82
83////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
84template <class Coll>
85void printCollection (Coll& aColl, const char * str)
86{
87 printf ("%s:\n",str);
88 Standard_Integer iSize = aColl.Size();
89 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
90 typename Coll::Iterator anIter (aColl);
91 if (!anIter.More())
92 {
93 if (iSize==0)
94 printf (" <Empty collection>\n");
95 else
96 printf ("Error : empty collection has size==%d",iSize);
97 }
98 else
99 {
100 printf (" Size==%d\n",iSize);
101 for (; anIter.More(); anIter.Next())
102 PrintItem(anIter.Value());
103 }
104}
105
106////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
107//////////////////////////////// QANCollection_BaseCol& aCollDst)
108template <class Coll>
109void AssignCollection (Coll& aCollSrc, Coll& aCollDst)
110{
111 printCollection (aCollSrc,"Source collection");
112 aCollDst.Assign(aCollSrc);
113 printCollection (aCollDst,"Target collection");
114}
115
116// ===================== Test methods of Array1 type ==========================
117////////////////////////////////void TestArray1 (QANCollection_Array1& theA1)
118static void TestArray1 (QANCollection_Array1Func& theA1)
119{
120 // Bounds
121 Standard_Integer iLow=theA1.Lower();
122 Standard_Integer iUpp=theA1.Upper();
123 Standard_Integer i;
124
125 printf ("Info: testing Array1(%d,%d), %s\n",
126 iLow, iUpp, (theA1.IsDeletable()?"deletable":"frozen"));
127 // C-array constructor, Length, Init
128 ItemType anItem;
129 Random(anItem);
130 theA1.Init (anItem);
131 ItemType * rBlock = new ItemType[theA1.Length()];
132 ////////////////////////////////QANCollection_Array1 aCArr(*rBlock, iLow-100, iUpp-100);
133 QANCollection_Array1Func aCArr(*rBlock, iLow-100, iUpp-100);
134 printf (" created the same sized preallocated array (%d,%d), %s\n",
135 aCArr.Lower(),aCArr.Upper(),(aCArr.IsDeletable()?"deletable":"frozen"));
136 // *Value, operator()
137 for (i=iLow+1; i<iUpp; i++)
138 {
139 Random (aCArr.ChangeValue (i-101));
140 aCArr.SetValue (i-100, ItemType(aCArr.Value(i-101)));
141 aCArr(i-99) = aCArr(i-100) = aCArr(i-101);
142 }
143 // Handle, copy constructor (including operator=)
144 ////////////////////////////////Handle(QANCollection_HArray1) aHa = new QANCollection_HArray1(aCArr);
145 Handle(QANCollection_HArray1Func) aHa = new QANCollection_HArray1Func(aCArr);
146 // Assign
147 AssignCollection (aHa->ChangeArray1(), theA1);
148}
149
150// ===================== Test methods of Array2 type ==========================
151////////////////////////////////void TestArray2 (QANCollection_Array2& theA2)
152static void TestArray2 (QANCollection_Array2Func& theA2)
153{
154 // Bounds
155 Standard_Integer iLR=theA2.LowerRow(), iLC=theA2.LowerCol();
156 Standard_Integer iUR=theA2.UpperRow(), iUC=theA2.UpperCol();
157 Standard_Integer i,j;
158
159 printf ("Info: testing Array2 (%d,%d)(%d,%d), %s\n",
160 iLR, iUR, iLC, iUC, (theA2.IsDeletable()?"deletable":"frozen"));
161 // C-array constructor, Length, Init, RowLength, ColLength
162 ItemType anItem;
163 Random(anItem);
164 theA2.Init (anItem);
165 ItemType * rBlock = new ItemType[theA2.Length()];
166 ////////////////////////////////QANCollection_Array2 aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
167 QANCollection_Array2Func aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
168 printf (" created the same sized preallocated array (%d*%d), %s\n",
169 aCArr.RowLength(), aCArr.ColLength(),
170 (aCArr.IsDeletable()?"deletable":"frozen"));
171 // *Value, operator()
172 for (i=iLR+1; i<iUR; i++)
173 {
174 for (j=iLC; j<=iUC; j++)
175 {
176 Random (aCArr.ChangeValue (i-101, j));
177 aCArr.SetValue (i-100, j,
178 ItemType(aCArr.Value(i-101,j)));
179 aCArr(i-99,j) = aCArr(i-100,j) = aCArr(i-101,j);
180 }
181 }
182 // Handle, copy constructor (including operator=)
183 ////////////////////////////////Handle(QANCollection_HArray2) aHa = new QANCollection_HArray2(aCArr);
184 Handle(QANCollection_HArray2Func) aHa = new QANCollection_HArray2Func(aCArr);
185 // Assign
186 AssignCollection (aHa->ChangeArray2(), theA2);
187}
188
189// ===================== Test methods of List type ==========================
190////////////////////////////////void TestList (QANCollection_List& theL)
191static void TestList (QANCollection_ListFunc& theL)
192{
193 // Extent
194 Standard_Integer iExt=theL.Extent();
195 Standard_Integer i;
196
197 printf ("Info: testing List(%d)\n", iExt);
198 // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
199 // Remove, RemoveFirst, First, Last
200 ItemType anItem;
201 ////////////////////////////////QANCollection_List aL, aL1;
202 QANCollection_ListFunc aL, aL1;
203 for (i=0; i<4; i++)
204 {
205 Random (anItem);
206 aL.Append (anItem); // #1
207 aL.Append (aL1); // #2
208 Random (anItem);
209 aL1.Prepend (anItem); // #3
210 aL1.Prepend (aL); // #4
211 ////////////////////////////////QANCollection_List::Iterator anI(theL);
212 QANCollection_ListFunc::Iterator anI(theL);
213 if (anI.More())
214 {
215 Random (anItem);
216 theL.InsertBefore (anItem, anI); // #5
217 theL.InsertBefore (aL1, anI); // #6
218 Random (anItem);
219 theL.InsertAfter (anItem, anI); // #7
220 theL.InsertAfter (aL, anI); // #8
221 theL.Remove (anI); // #9
222 if (theL.Extent() > 0)
223 theL.RemoveFirst(); // #10
224 }
225 else
226 {
227 theL.Prepend (anItem);
228 PrintItem(theL.First());
229 PrintItem(theL.Last());
230 }
231 }
232 // Copy constructor + operator=
233 ////////////////////////////////aL = QANCollection_List(theL);
234 aL = QANCollection_ListFunc(theL);
235
236 // Assign
237 AssignCollection (theL, aL);
238
239 // Clear
240 aL.Clear();
241}
242
243// ===================== Test methods of Sequence type ========================
244////////////////////////////////void TestSequence (QANCollection_Sequence& theS)
245static void TestSequence (QANCollection_SequenceFunc& theS)
246{
247 Standard_Integer i;
248
249 printf ("Info: testing Sequence\n");
250 // Append(2)
251 ItemType anItem;
252 ////////////////////////////////QANCollection_Sequence aS, aS1;
253 QANCollection_SequenceFunc aS, aS1;
254 // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
255 // Remove, RemoveFirst, First, Last
256 for (i=0; i<4; i++)
257 {
258 Random (anItem);
259 aS.Append (anItem); // #1
260 aS.Append (aS1); // #2
261 Random (anItem);
262 aS1.Prepend (anItem); // #3
263 aS1.Prepend (aS); // #4
264 if (theS.Length() > 0)
265 {
266 Random (anItem);
267 theS.InsertBefore (1, anItem); // #5
268 theS.InsertBefore (2, aS1); // #6
269 Random (anItem);
270 theS.InsertAfter (1, anItem); // #7
271 theS.InsertAfter (2, aS); // #8
272 theS.Remove (1); // #9
273 if (theS.Length() > 0)
274 theS.Remove(1); // #10
275 }
276 else
277 {
278 theS.Prepend (anItem);
279 PrintItem(theS.First());
280 PrintItem(theS.Last());
281 }
282 }
283
284 // ()
285 PrintItem(theS(1));
286
287 // Handle, Split
288 ////////////////////////////////Handle(QANCollection_HSequence) aHS = new QANCollection_HSequence(aS1);
289 Handle(QANCollection_HSequenceFunc) aHS = new QANCollection_HSequenceFunc(aS1);
290 theS.Split (3, aHS->ChangeSequence());
291
292 // Assign
293 AssignCollection (theS, aS);
294
295 // Clear
296 aS.Clear();
297}
298
299// ===================== Test methods of Map type =============================
300////////////////////////////////void TestMap (QANCollection_Map& theM)
301static void TestMap (QANCollection_MapFunc& theM)
302{
303 // Extent
304 Standard_Integer iExt=theM.Extent();
305 Standard_Integer i;
306
307 printf ("Info: testing Map(l=%d)\n", iExt);
308 theM.Statistics(cout);
309 // Resize
310 theM.ReSize(8);
311 theM.Statistics(cout);
312 cout.flush();
313 // Constructor
314 ////////////////////////////////QANCollection_Map aM;
315 QANCollection_MapFunc aM;
316 // Add
317 Key1Type aKey;
318 for (i=0; i<8; i++)
319 {
320 Random (aKey);
321 aM.Add (aKey);
322 }
323 // Contains, Remove
324 if (!aM.Contains(aKey))
325 {
326 printf("Error : map says that it does not contain its key ");
327 PrintItem(aKey);
328 }
329 else
330 {
331 aM.Remove(aKey);
332 printf(" successfully removed item, l=%d\n", aM.Size());
333 }
334 // Copy constructor (including operator=)
335 ////////////////////////////////QANCollection_Map aM2 = QANCollection_Map(aM);
336 QANCollection_MapFunc aM2 = QANCollection_MapFunc(aM);
337 // Assign
338 AssignCollection (aM2,theM);
339
340 // Clear
341 aM.Clear();
342}
343
344// ===================== Test methods of DataMap type =========================
345////////////////////////////////void TestDataMap (QANCollection_DataMap& theM)
346static void TestDataMap (QANCollection_DataMapFunc& theM)
347{
348 // Extent
349 Standard_Integer iExt=theM.Extent();
350 Standard_Integer i;
351
352 printf ("Info: testing DataMap(l=%d)\n", iExt);
353 theM.Statistics(cout);
354 // Resize
355 theM.ReSize(8);
356 theM.Statistics(cout);
357 cout.flush();
358 // Constructor
359 ////////////////////////////////QANCollection_DataMap aM;
360 QANCollection_DataMapFunc aM;
361 // Bind, Find, ChangeFind, ()
362 Key1Type aKey;
363 ItemType anItem;
364 for (i=0; i<8; i++)
365 {
366 Random (aKey);
367 Random (anItem);
368 aM.Bind (aKey, anItem);
369 PrintItem(aM.Find(aKey));
370 Random(aM(aKey));
371 }
372 // IsBound, UnBind
373 if (!aM.IsBound(aKey))
374 {
375 printf("Error : map says that it does not contain its key ");
376 PrintItem(aKey);
377 }
378 else
379 {
380 aM.UnBind(aKey);
381 printf(" successfully unbound the key, l=%d\n", aM.Size());
382 }
383 // Copy constructor (including operator=)
384 ////////////////////////////////theM = QANCollection_DataMap(aM);
385 theM = QANCollection_DataMapFunc(aM);
386 // Assign - prohibited
387 // AssignCollection (aM2,theM);
388 printCollection (theM, "DataMap:");
389
390 // Clear
391 aM.Clear();
392}
393
394
395// ===================== Test methods of DoubleMap type =======================
396////////////////////////////////void TestDoubleMap (QANCollection_DoubleMap& theM)
397static void TestDoubleMap (QANCollection_DoubleMapFunc& theM)
398{
399 // Extent
400 Standard_Integer iExt=theM.Extent();
401 Standard_Integer i;
402
403 printf ("Info: testing DoubleMap(l=%d)\n", iExt);
404 theM.Statistics(cout);
405 // Resize
406 theM.ReSize(8);
407 theM.Statistics(cout);
408 cout.flush();
409 // Constructor
410 ////////////////////////////////QANCollection_DoubleMap aM;
411 QANCollection_DoubleMapFunc aM;
412 // Bind, Find?,
413 Key1Type aKey1;
414 Key2Type aKey2;
415 for (i=0; i<8; i++)
416 {
417 Random (aKey1);
418 Random (aKey2);
419 aM.Bind (aKey1, aKey2);
420 PrintItem(aM.Find1(aKey1));
421 if (!aM.IsBound1(aKey1))
422 {
423 printf("Error : map says that it does not contain its key ");
424 PrintItem(aKey1);
425 }
426 PrintItem(aM.Find2(aKey2));
427 if (!aM.IsBound2(aKey2))
428 {
429 printf("Error : map says that it does not contain its key ");
430 PrintItem(aKey2);
431 }
432 }
433 // AreBound, UnBind
434 if (!aM.AreBound(aKey1,aKey2))
435 {
436 printf("Error : map says that it does not contain its keys ");
437 PrintItem(aKey1);
438 PrintItem(aKey2);
439 }
440 else
441 {
442 if (aM.UnBind2(aKey2))
443 printf(" successfully unbound the key, l=%d\n", aM.Size());
444 if (aM.UnBind1(aKey1))
445 printf("Error : unbound both keys?!\n");
446 }
447 // Copy constructor (including operator=)
448 ////////////////////////////////theM = QANCollection_DoubleMap(aM);
449 theM = QANCollection_DoubleMapFunc(aM);
450 // Assign - prohibited
451 // AssignCollection (aM2,theM);
452 printCollection (theM, "DoubleMap:");
453
454 // Clear
455 aM.Clear();
456}
457
458// ===================== Test methods of IndexedMap type ======================
459////////////////////////////////void TestIndexedMap (QANCollection_IndexedMap& theM)
460static void TestIndexedMap (QANCollection_IndexedMapFunc& theM)
461{
462 // Extent
463 Standard_Integer iExt=theM.Extent();
464 Standard_Integer i;
465
466 printf ("Info: testing IndexedMap(l=%d)\n", iExt);
467 theM.Statistics(cout);
468 // Resize
469 theM.ReSize(8);
470 theM.Statistics(cout);
471 cout.flush();
472 // Constructor
473 ////////////////////////////////QANCollection_IndexedMap aM;
474 QANCollection_IndexedMapFunc aM;
475 // Add, FindKey, FindIndex
476 Key1Type aKey;
477 for (i=0; i<8; i++)
478 {
479 Random (aKey);
480 aM.Add (aKey);
481 Standard_Integer iIndex=aM.FindIndex(aKey);
482 printf (" added a key, i=%d, k=",iIndex);
483 PrintItem(aM(iIndex));
484 }
485 // Contains, Remove
486 if (!aM.Contains(aM.FindKey(aM.FindIndex(aKey))))
487 {
488 printf("Error : map says that it does not contain its key ");
489 PrintItem(aKey);
490 }
491 else
492 {
493 aM.RemoveLast();
494 printf(" successfully removed item, l=%d\n", aM.Size());
495 }
496 // Substitute
497 Random(aKey);
498 aM.Substitute(1,aKey);
499 // Copy constructor (including operator=)
500 ////////////////////////////////QANCollection_IndexedMap aM2 = QANCollection_IndexedMap(aM);
501 QANCollection_IndexedMapFunc aM2 = QANCollection_IndexedMapFunc(aM);
502 // Assign
503 AssignCollection (aM2,theM);
504
505 // Clear
506 aM.Clear();
507}
508
509// ===================== Test methods of IndexedDataMap type ==================
510////////////////////////////////void TestIndexedDataMap (QANCollection_IDMap& theM)
511static void TestIndexedDataMap (QANCollection_IDMapFunc& theM)
512{
513 // Extent
514 Standard_Integer iExt=theM.Extent();
515 Standard_Integer i;
516
517 printf ("Info: testing IndexedDataMap(l=%d)\n", iExt);
518 theM.Statistics(cout);
519 // Resize
520 theM.ReSize(8);
521 theM.Statistics(cout);
522 cout.flush();
523 // Constructor
524 ////////////////////////////////QANCollection_IDMap aM;
525 QANCollection_IDMapFunc aM;
526 // Add, FindKey, FindIndex, FindFromIndex, Change..., ()
527 Key1Type aKey;
528 ItemType anItem;
529 for (i=0; i<8; i++)
530 {
531 Random (aKey);
532 Random (anItem);
533 aM.Add (aKey, anItem);
534 Standard_Integer iIndex=aM.FindIndex(aKey);
535 printf (" added a key, i=%d, k=",iIndex);
536 PrintItem(aM.FindKey(iIndex));
537 PrintItem(aM(iIndex));
538 Random(aM.ChangeFromIndex(iIndex));
539 }
540 // Contains, Remove, FindFromKey
541 if (!aM.Contains(aM.FindKey(aM.FindIndex(aKey))))
542 {
543 printf("Error : map says that it does not contain its key ");
544 PrintItem(aKey);
545 }
546 else
547 {
548 anItem = aM.FindFromKey(aKey);
549 aM.RemoveLast();
550 printf(" successfully removed item, l=%d\n", aM.Size());
551 }
552 // Substitute
553 Random(aKey);
554 aM.Substitute (1, aKey, anItem);
555 // Copy constructor (including operator=)
556 ////////////////////////////////theM = QANCollection_IDMap(aM);
557 theM = QANCollection_IDMapFunc(aM);
558 // Assign - prohibited
559 // AssignCollection (aM2,theM);
560 printCollection (theM, "DoubleMap:");
561
562 // Clear
563 aM.Clear();
564}
565
566//=======================================================================
567//function : CheckArguments1
568//purpose :
569//=======================================================================
570Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper)
571{
572 if ( argc != 3) {
573 di << "Usage : " << argv[0] << " Lower Upper" << "\n";
574 return 1;
575 }
576 Lower = Draw::Atoi(argv[1]);
577 Upper = Draw::Atoi(argv[2]);
578 if ( Lower > Upper ) {
579 di << "Lower > Upper" << "\n";
580 return 1;
581 }
582 return 0;
583}
584
585//=======================================================================
586//function : CheckArguments2
587//purpose :
588//=======================================================================
589Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol)
590{
591 if ( argc != 5) {
592 di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n";
593 return 1;
594 }
595 LowerRow = Draw::Atoi(argv[1]);
596 UpperRow = Draw::Atoi(argv[2]);
597 LowerCol = Draw::Atoi(argv[3]);
598 UpperCol = Draw::Atoi(argv[4]);
599 if ( LowerRow > UpperRow ) {
600 di << "LowerRow > UpperRow" << "\n";
601 return 1;
602 }
603 if ( LowerCol > UpperCol ) {
604 di << "LowerCol UpperCol> " << "\n";
605 return 1;
606 }
607 return 0;
608}
609
610
611//=======================================================================
612//function : QANColTestArray1
613//purpose :
614//=======================================================================
615static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
616{
617 Standard_Integer Lower, Upper;
618 if ( CheckArguments1(di, argc, argv, Lower, Upper) ) {
619 return 1;
620 }
621 QANCollection_Array1Func anArr1(Lower, Upper);
622 TestArray1(anArr1);
623 return 0;
624}
625
626//=======================================================================
627//function : QANColTestArray2
628//purpose :
629//=======================================================================
630static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
631{
632 Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol;
633 if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) {
634 return 1;
635 }
636 QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol);
637 TestArray2(anArr2);
638 return 0;
639}
640
641//=======================================================================
642//function : QANColTestMap
643//purpose :
644//=======================================================================
645static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
646{
647 if ( argc != 1) {
648 di << "Usage : " << argv[0] << "\n";
649 return 1;
650 }
651 QANCollection_MapFunc aMap;
652 TestMap(aMap);
653 return 0;
654}
655
656//=======================================================================
657//function : QANColTestDataMap
658//purpose :
659//=======================================================================
660static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
661{
662 if ( argc != 1) {
663 di << "Usage : " << argv[0] << "\n";
664 return 1;
665 }
666 QANCollection_DataMapFunc aDataMap;
667 TestDataMap(aDataMap);
668 return 0;
669}
670
671//=======================================================================
672//function : QANColTestDoubleMap
673//purpose :
674//=======================================================================
675static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
676{
677 if ( argc != 1) {
678 di << "Usage : " << argv[0] << "\n";
679 return 1;
680 }
681 QANCollection_DoubleMapFunc aDoubleMap;
682 TestDoubleMap(aDoubleMap);
683 return 0;
684}
685
686//=======================================================================
687//function : QANColTestIndexedMap
688//purpose :
689//=======================================================================
690static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
691{
692 if ( argc != 1) {
693 di << "Usage : " << argv[0] << "\n";
694 return 1;
695 }
696 QANCollection_IndexedMapFunc aIndexedMap;
697 TestIndexedMap(aIndexedMap);
698 return 0;
699}
700
701//=======================================================================
702//function : QANColTestIndexedDataMap
703//purpose :
704//=======================================================================
705static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
706{
707 if ( argc != 1) {
708 di << "Usage : " << argv[0] << "\n";
709 return 1;
710 }
711 QANCollection_IDMapFunc aIDMap;
712 TestIndexedDataMap(aIDMap);
713 return 0;
714}
715
716//=======================================================================
717//function : QANColTestList
718//purpose :
719//=======================================================================
720static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
721{
722 if ( argc != 1) {
723 di << "Usage : " << argv[0] << "\n";
724 return 1;
725 }
726 QANCollection_ListFunc aList;
727 TestList(aList);
728 return 0;
729}
730
731//=======================================================================
732//function : QANColTestSequence
733//purpose :
734//=======================================================================
735static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
736{
737 if ( argc != 1) {
738 di << "Usage : " << argv[0] << "\n";
739 return 1;
740 }
741 QANCollection_SequenceFunc aSeq;
742 TestSequence(aSeq);
743 return 0;
744}
745
746void QANCollection::CommandsTest(Draw_Interpretor& theCommands) {
747 const char *group = "QANCollection";
748
749 // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
750 theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group);
751 theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group);
752 theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group);
753 theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group);
754 theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group);
755 theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
756 theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
757 theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
758 theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
759
760 return;
761}