1 // Created on: 2004-03-05
2 // Created by: Mikhail KUZMITCHEV
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <QANCollection.hxx>
19 #include <Draw_Interpretor.hxx>
23 // HashCode and IsEquel must be defined for key types of maps
24 Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper)
26 return HashCode(thePnt.X(),theUpper);
29 Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2)
31 return theP1.IsEqual(theP2,gp::Resolution());
34 #define ItemType gp_Pnt
35 #define Key1Type gp_Pnt
36 #define Key2Type Standard_Real
38 #include <QANCollection_FuncTest.hxx>
40 IMPLEMENT_HARRAY1(QANCollection_HArray1Func)
41 IMPLEMENT_HARRAY2(QANCollection_HArray2Func)
42 IMPLEMENT_HSET(QANCollection_HSetFunc)
43 IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc)
45 //=======================================================================
46 //function : CheckArguments1
48 //=======================================================================
49 Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper)
52 di << "Usage : " << argv[0] << " Lower Upper" << "\n";
55 Lower = Draw::Atoi(argv[1]);
56 Upper = Draw::Atoi(argv[2]);
57 if ( Lower > Upper ) {
58 di << "Lower > Upper" << "\n";
64 //=======================================================================
65 //function : CheckArguments2
67 //=======================================================================
68 Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol)
71 di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n";
74 LowerRow = Draw::Atoi(argv[1]);
75 UpperRow = Draw::Atoi(argv[2]);
76 LowerCol = Draw::Atoi(argv[3]);
77 UpperCol = Draw::Atoi(argv[4]);
78 if ( LowerRow > UpperRow ) {
79 di << "LowerRow > UpperRow" << "\n";
82 if ( LowerCol > UpperCol ) {
83 di << "LowerCol UpperCol> " << "\n";
90 //=======================================================================
91 //function : QANColTestArray1
93 //=======================================================================
94 static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
96 Standard_Integer Lower, Upper;
97 if ( CheckArguments1(di, argc, argv, Lower, Upper) ) {
100 QANCollection_Array1Func anArr1(Lower, Upper);
105 //=======================================================================
106 //function : QANColTestArray2
108 //=======================================================================
109 static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
111 Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol;
112 if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) {
115 QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol);
120 //=======================================================================
121 //function : QANColTestMap
123 //=======================================================================
124 static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
127 di << "Usage : " << argv[0] << "\n";
130 QANCollection_MapFunc aMap;
135 //=======================================================================
136 //function : QANColTestDataMap
138 //=======================================================================
139 static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
142 di << "Usage : " << argv[0] << "\n";
145 QANCollection_DataMapFunc aDataMap;
146 TestDataMap(aDataMap);
150 //=======================================================================
151 //function : QANColTestDoubleMap
153 //=======================================================================
154 static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
157 di << "Usage : " << argv[0] << "\n";
160 QANCollection_DoubleMapFunc aDoubleMap;
161 TestDoubleMap(aDoubleMap);
165 //=======================================================================
166 //function : QANColTestIndexedMap
168 //=======================================================================
169 static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
172 di << "Usage : " << argv[0] << "\n";
175 QANCollection_IndexedMapFunc aIndexedMap;
176 TestIndexedMap(aIndexedMap);
180 //=======================================================================
181 //function : QANColTestIndexedDataMap
183 //=======================================================================
184 static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
187 di << "Usage : " << argv[0] << "\n";
190 QANCollection_IDMapFunc aIDMap;
191 TestIndexedDataMap(aIDMap);
195 //=======================================================================
196 //function : QANColTestList
198 //=======================================================================
199 static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
202 di << "Usage : " << argv[0] << "\n";
205 QANCollection_ListFunc aList;
210 //=======================================================================
211 //function : QANColTestSet
213 //=======================================================================
214 static Standard_Integer QANColTestSet(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
217 di << "Usage : " << argv[0] << "\n";
220 QANCollection_SetFunc aSet;
225 //=======================================================================
226 //function : QANColTestSequence
228 //=======================================================================
229 static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
232 di << "Usage : " << argv[0] << "\n";
235 QANCollection_SequenceFunc aSeq;
240 void QANCollection::Commands2(Draw_Interpretor& theCommands) {
241 const char *group = "QANCollection";
243 // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
244 theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group);
245 theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group);
246 theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group);
247 theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group);
248 theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group);
249 theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
250 theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
251 theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
252 theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
253 theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);