1 // Created on: 2004-03-05
2 // Created by: Mikhail KUZMITCHEV
3 // Copyright (c) 2004-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #include <QANCollection.hxx>
23 #include <Draw_Interpretor.hxx>
27 // HashCode and IsEquel must be defined for key types of maps
28 Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper)
30 return HashCode(thePnt.X(),theUpper);
33 Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2)
35 return theP1.IsEqual(theP2,gp::Resolution());
38 #define ItemType gp_Pnt
39 #define Key1Type gp_Pnt
40 #define Key2Type Standard_Real
42 #include <QANCollection_FuncTest.hxx>
44 IMPLEMENT_HARRAY1(QANCollection_HArray1Func)
45 IMPLEMENT_HARRAY2(QANCollection_HArray2Func)
46 IMPLEMENT_HSET(QANCollection_HSetFunc)
47 IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc)
49 //=======================================================================
50 //function : CheckArguments1
52 //=======================================================================
53 Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper)
56 di << "Usage : " << argv[0] << " Lower Upper" << "\n";
59 Lower = Draw::Atoi(argv[1]);
60 Upper = Draw::Atoi(argv[2]);
61 if ( Lower > Upper ) {
62 di << "Lower > Upper" << "\n";
68 //=======================================================================
69 //function : CheckArguments2
71 //=======================================================================
72 Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol)
75 di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n";
78 LowerRow = Draw::Atoi(argv[1]);
79 UpperRow = Draw::Atoi(argv[2]);
80 LowerCol = Draw::Atoi(argv[3]);
81 UpperCol = Draw::Atoi(argv[4]);
82 if ( LowerRow > UpperRow ) {
83 di << "LowerRow > UpperRow" << "\n";
86 if ( LowerCol > UpperCol ) {
87 di << "LowerCol UpperCol> " << "\n";
94 //=======================================================================
95 //function : QANColTestArray1
97 //=======================================================================
98 static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
100 Standard_Integer Lower, Upper;
101 if ( CheckArguments1(di, argc, argv, Lower, Upper) ) {
104 QANCollection_Array1Func anArr1(Lower, Upper);
109 //=======================================================================
110 //function : QANColTestArray2
112 //=======================================================================
113 static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
115 Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol;
116 if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) {
119 QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol);
124 //=======================================================================
125 //function : QANColTestMap
127 //=======================================================================
128 static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
131 di << "Usage : " << argv[0] << "\n";
134 QANCollection_MapFunc aMap;
139 //=======================================================================
140 //function : QANColTestDataMap
142 //=======================================================================
143 static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
146 di << "Usage : " << argv[0] << "\n";
149 QANCollection_DataMapFunc aDataMap;
150 TestDataMap(aDataMap);
154 //=======================================================================
155 //function : QANColTestDoubleMap
157 //=======================================================================
158 static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
161 di << "Usage : " << argv[0] << "\n";
164 QANCollection_DoubleMapFunc aDoubleMap;
165 TestDoubleMap(aDoubleMap);
169 //=======================================================================
170 //function : QANColTestIndexedMap
172 //=======================================================================
173 static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
176 di << "Usage : " << argv[0] << "\n";
179 QANCollection_IndexedMapFunc aIndexedMap;
180 TestIndexedMap(aIndexedMap);
184 //=======================================================================
185 //function : QANColTestIndexedDataMap
187 //=======================================================================
188 static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
191 di << "Usage : " << argv[0] << "\n";
194 QANCollection_IDMapFunc aIDMap;
195 TestIndexedDataMap(aIDMap);
199 //=======================================================================
200 //function : QANColTestList
202 //=======================================================================
203 static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
206 di << "Usage : " << argv[0] << "\n";
209 QANCollection_ListFunc aList;
214 //=======================================================================
215 //function : QANColTestQueue
217 //=======================================================================
218 static Standard_Integer QANColTestQueue(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
221 di << "Usage : " << argv[0] << "\n";
224 QANCollection_QueueFunc aQueue;
229 //=======================================================================
230 //function : QANColTestStack
232 //=======================================================================
233 static Standard_Integer QANColTestStack(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
236 di << "Usage : " << argv[0] << "\n";
239 QANCollection_StackFunc aStack;
244 //=======================================================================
245 //function : QANColTestSet
247 //=======================================================================
248 static Standard_Integer QANColTestSet(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
251 di << "Usage : " << argv[0] << "\n";
254 QANCollection_SetFunc aSet;
259 //=======================================================================
260 //function : QANColTestSList
262 //=======================================================================
263 static Standard_Integer QANColTestSList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
266 di << "Usage : " << argv[0] << "\n";
269 QANCollection_SListFunc aSList;
274 //=======================================================================
275 //function : QANColTestSequence
277 //=======================================================================
278 static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
281 di << "Usage : " << argv[0] << "\n";
284 QANCollection_SequenceFunc aSeq;
289 void QANCollection::Commands2(Draw_Interpretor& theCommands) {
290 const char *group = "QANCollection";
292 // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
293 theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group);
294 theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group);
295 theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group);
296 theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group);
297 theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group);
298 theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
299 theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
300 theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
301 theCommands.Add("QANColTestQueue", "QANColTestQueue", __FILE__, QANColTestQueue, group);
302 theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group);
303 theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
304 theCommands.Add("QANColTestSList", "QANColTestSList", __FILE__, QANColTestSList, group);
305 theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);