1 // Created on: 2002-04-30
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-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.
22 #ifndef QANCollection_FuncArrays_HeaderFile
23 #define QANCollection_FuncArrays_HeaderFile
25 // ===================== Test methods of Array1 type ==========================
26 ////////////////////////////////void TestArray1 (QANCollection_Array1& theA1)
27 void TestArray1 (QANCollection_Array1Func& theA1)
30 Standard_Integer iLow=theA1.Lower();
31 Standard_Integer iUpp=theA1.Upper();
34 printf ("Info: testing Array1(%d,%d), %s\n",
35 iLow, iUpp, (theA1.IsDeletable()?"deletable":"frozen"));
36 // C-array constructor, Length, Init
40 ItemType * rBlock = new ItemType[theA1.Length()];
41 ////////////////////////////////QANCollection_Array1 aCArr(*rBlock, iLow-100, iUpp-100);
42 QANCollection_Array1Func aCArr(*rBlock, iLow-100, iUpp-100);
43 printf (" created the same sized preallocated array (%d,%d), %s\n",
44 aCArr.Lower(),aCArr.Upper(),(aCArr.IsDeletable()?"deletable":"frozen"));
46 for (i=iLow+1; i<iUpp; i++)
48 Random (aCArr.ChangeValue (i-101));
49 aCArr.SetValue (i-100, ItemType(aCArr.Value(i-101)));
50 aCArr(i-99) = aCArr(i-100) = aCArr(i-101);
52 // Handle, copy constructor (including operator=)
53 ////////////////////////////////Handle(QANCollection_HArray1) aHa = new QANCollection_HArray1(aCArr);
54 Handle(QANCollection_HArray1Func) aHa = new QANCollection_HArray1Func(aCArr);
56 AssignCollection (aHa->ChangeArray1(), theA1);
59 // ===================== Test methods of Array2 type ==========================
60 ////////////////////////////////void TestArray2 (QANCollection_Array2& theA2)
61 void TestArray2 (QANCollection_Array2Func& theA2)
64 Standard_Integer iLR=theA2.LowerRow(), iLC=theA2.LowerCol();
65 Standard_Integer iUR=theA2.UpperRow(), iUC=theA2.UpperCol();
68 printf ("Info: testing Array2 (%d,%d)(%d,%d), %s\n",
69 iLR, iUR, iLC, iUC, (theA2.IsDeletable()?"deletable":"frozen"));
70 // C-array constructor, Length, Init, RowLength, ColLength
74 ItemType * rBlock = new ItemType[theA2.Length()];
75 ////////////////////////////////QANCollection_Array2 aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
76 QANCollection_Array2Func aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
77 printf (" created the same sized preallocated array (%d*%d), %s\n",
78 aCArr.RowLength(), aCArr.ColLength(),
79 (aCArr.IsDeletable()?"deletable":"frozen"));
81 for (i=iLR+1; i<iUR; i++)
83 for (j=iLC; j<=iUC; j++)
85 Random (aCArr.ChangeValue (i-101, j));
86 aCArr.SetValue (i-100, j,
87 ItemType(aCArr.Value(i-101,j)));
88 aCArr(i-99,j) = aCArr(i-100,j) = aCArr(i-101,j);
91 // Handle, copy constructor (including operator=)
92 ////////////////////////////////Handle(QANCollection_HArray2) aHa = new QANCollection_HArray2(aCArr);
93 Handle(QANCollection_HArray2Func) aHa = new QANCollection_HArray2Func(aCArr);
95 AssignCollection (aHa->ChangeArray2(), theA2);