b311480e |
1 | // Created on: 2004-03-05 |
2 | // Created by: Mikhail KUZMITCHEV |
3 | // Copyright (c) 2004-2012 OPEN CASCADE SAS |
4 | // |
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. |
9 | // |
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. |
12 | // |
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. |
19 | |
7fd59977 |
20 | |
21 | |
22 | #include <QANCollection.hxx> |
23 | #include <Draw_Interpretor.hxx> |
24 | |
25 | #include <gp_Pnt.hxx> |
26 | // HashCode and IsEquel must be defined for key types of maps |
27 | |
28 | Standard_Integer HashCode(const gp_Pnt thePnt, |
29 | int theUpper) |
30 | { |
31 | return HashCode(thePnt.X(),theUpper); |
32 | } |
33 | |
34 | Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2) |
35 | { |
36 | return theP1.IsEqual(theP2,gp::Resolution()); |
37 | } |
38 | |
39 | #define ItemType gp_Pnt |
40 | #define Key1Type gp_Pnt |
41 | #define Key2Type Standard_Real |
42 | |
43 | #include <QANCollection_FuncTest.hxx> |
44 | |
45 | IMPLEMENT_HARRAY1(QANCollection_HArray1Func) |
46 | IMPLEMENT_HARRAY2(QANCollection_HArray2Func) |
47 | IMPLEMENT_HSET(QANCollection_HSetFunc) |
48 | IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc) |
49 | |
50 | //======================================================================= |
51 | //function : CheckArguments1 |
52 | //purpose : |
53 | //======================================================================= |
54 | Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper) |
55 | { |
56 | if ( argc != 3) { |
57 | di << "Usage : " << argv[0] << " Lower Upper" << "\n"; |
58 | return 1; |
59 | } |
60 | Lower = atoi(argv[1]); |
61 | Upper = atoi(argv[2]); |
62 | if ( Lower > Upper ) { |
63 | di << "Lower > Upper" << "\n"; |
64 | return 1; |
65 | } |
66 | return 0; |
67 | } |
68 | |
69 | //======================================================================= |
70 | //function : CheckArguments2 |
71 | //purpose : |
72 | //======================================================================= |
73 | Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol) |
74 | { |
75 | if ( argc != 5) { |
76 | di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n"; |
77 | return 1; |
78 | } |
79 | LowerRow = atoi(argv[1]); |
80 | UpperRow = atoi(argv[2]); |
81 | LowerCol = atoi(argv[3]); |
82 | UpperCol = atoi(argv[4]); |
83 | if ( LowerRow > UpperRow ) { |
84 | di << "LowerRow > UpperRow" << "\n"; |
85 | return 1; |
86 | } |
87 | if ( LowerCol > UpperCol ) { |
88 | di << "LowerCol UpperCol> " << "\n"; |
89 | return 1; |
90 | } |
91 | return 0; |
92 | } |
93 | |
94 | |
95 | //======================================================================= |
96 | //function : QANColTestArray1 |
97 | //purpose : |
98 | //======================================================================= |
99 | static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
100 | { |
101 | Standard_Integer Lower, Upper; |
102 | if ( CheckArguments1(di, argc, argv, Lower, Upper) ) { |
103 | return 1; |
104 | } |
105 | QANCollection_Array1Func anArr1(Lower, Upper); |
106 | TestArray1(anArr1); |
107 | return 0; |
108 | } |
109 | |
110 | //======================================================================= |
111 | //function : QANColTestArray2 |
112 | //purpose : |
113 | //======================================================================= |
114 | static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
115 | { |
116 | Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol; |
117 | if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) { |
118 | return 1; |
119 | } |
120 | QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol); |
121 | TestArray2(anArr2); |
122 | return 0; |
123 | } |
124 | |
125 | //======================================================================= |
126 | //function : QANColTestMap |
127 | //purpose : |
128 | //======================================================================= |
129 | static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
130 | { |
131 | if ( argc != 1) { |
132 | di << "Usage : " << argv[0] << "\n"; |
133 | return 1; |
134 | } |
135 | QANCollection_MapFunc aMap; |
136 | TestMap(aMap); |
137 | return 0; |
138 | } |
139 | |
140 | //======================================================================= |
141 | //function : QANColTestDataMap |
142 | //purpose : |
143 | //======================================================================= |
144 | static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
145 | { |
146 | if ( argc != 1) { |
147 | di << "Usage : " << argv[0] << "\n"; |
148 | return 1; |
149 | } |
150 | QANCollection_DataMapFunc aDataMap; |
151 | TestDataMap(aDataMap); |
152 | return 0; |
153 | } |
154 | |
155 | //======================================================================= |
156 | //function : QANColTestDoubleMap |
157 | //purpose : |
158 | //======================================================================= |
159 | static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
160 | { |
161 | if ( argc != 1) { |
162 | di << "Usage : " << argv[0] << "\n"; |
163 | return 1; |
164 | } |
165 | QANCollection_DoubleMapFunc aDoubleMap; |
166 | TestDoubleMap(aDoubleMap); |
167 | return 0; |
168 | } |
169 | |
170 | //======================================================================= |
171 | //function : QANColTestIndexedMap |
172 | //purpose : |
173 | //======================================================================= |
174 | static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
175 | { |
176 | if ( argc != 1) { |
177 | di << "Usage : " << argv[0] << "\n"; |
178 | return 1; |
179 | } |
180 | QANCollection_IndexedMapFunc aIndexedMap; |
181 | TestIndexedMap(aIndexedMap); |
182 | return 0; |
183 | } |
184 | |
185 | //======================================================================= |
186 | //function : QANColTestIndexedDataMap |
187 | //purpose : |
188 | //======================================================================= |
189 | static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
190 | { |
191 | if ( argc != 1) { |
192 | di << "Usage : " << argv[0] << "\n"; |
193 | return 1; |
194 | } |
195 | QANCollection_IDMapFunc aIDMap; |
196 | TestIndexedDataMap(aIDMap); |
197 | return 0; |
198 | } |
199 | |
200 | //======================================================================= |
201 | //function : QANColTestList |
202 | //purpose : |
203 | //======================================================================= |
204 | static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
205 | { |
206 | if ( argc != 1) { |
207 | di << "Usage : " << argv[0] << "\n"; |
208 | return 1; |
209 | } |
210 | QANCollection_ListFunc aList; |
211 | TestList(aList); |
212 | return 0; |
213 | } |
214 | |
215 | //======================================================================= |
216 | //function : QANColTestQueue |
217 | //purpose : |
218 | //======================================================================= |
219 | static Standard_Integer QANColTestQueue(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
220 | { |
221 | if ( argc != 1) { |
222 | di << "Usage : " << argv[0] << "\n"; |
223 | return 1; |
224 | } |
225 | QANCollection_QueueFunc aQueue; |
226 | TestQueue(aQueue); |
227 | return 0; |
228 | } |
229 | |
230 | //======================================================================= |
231 | //function : QANColTestStack |
232 | //purpose : |
233 | //======================================================================= |
234 | static Standard_Integer QANColTestStack(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
235 | { |
236 | if ( argc != 1) { |
237 | di << "Usage : " << argv[0] << "\n"; |
238 | return 1; |
239 | } |
240 | QANCollection_StackFunc aStack; |
241 | TestStack(aStack); |
242 | return 0; |
243 | } |
244 | |
245 | //======================================================================= |
246 | //function : QANColTestSet |
247 | //purpose : |
248 | //======================================================================= |
249 | static Standard_Integer QANColTestSet(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
250 | { |
251 | if ( argc != 1) { |
252 | di << "Usage : " << argv[0] << "\n"; |
253 | return 1; |
254 | } |
255 | QANCollection_SetFunc aSet; |
256 | TestSet(aSet); |
257 | return 0; |
258 | } |
259 | |
260 | //======================================================================= |
261 | //function : QANColTestSList |
262 | //purpose : |
263 | //======================================================================= |
264 | static Standard_Integer QANColTestSList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
265 | { |
266 | if ( argc != 1) { |
267 | di << "Usage : " << argv[0] << "\n"; |
268 | return 1; |
269 | } |
270 | QANCollection_SListFunc aSList; |
271 | TestSList(aSList); |
272 | return 0; |
273 | } |
274 | |
275 | //======================================================================= |
276 | //function : QANColTestSequence |
277 | //purpose : |
278 | //======================================================================= |
279 | static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
280 | { |
281 | if ( argc != 1) { |
282 | di << "Usage : " << argv[0] << "\n"; |
283 | return 1; |
284 | } |
285 | QANCollection_SequenceFunc aSeq; |
286 | TestSequence(aSeq); |
287 | return 0; |
288 | } |
289 | |
290 | void QANCollection::Commands2(Draw_Interpretor& theCommands) { |
1365140b |
291 | const char *group = "QANCollection"; |
7fd59977 |
292 | |
293 | // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx |
294 | theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group); |
295 | theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group); |
296 | theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group); |
297 | theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group); |
298 | theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group); |
299 | theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group); |
300 | theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group); |
301 | theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group); |
302 | theCommands.Add("QANColTestQueue", "QANColTestQueue", __FILE__, QANColTestQueue, group); |
303 | theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group); |
304 | theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group); |
305 | theCommands.Add("QANColTestSList", "QANColTestSList", __FILE__, QANColTestSList, group); |
306 | theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group); |
307 | |
308 | return; |
309 | } |