0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32test\math\t_realxd.h
|
|
15 |
// T_REALXD.H - Structure definitions for TRealX test
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef __REALXTST_H__
|
|
21 |
#define __REALXTST_H__
|
|
22 |
|
|
23 |
#include <e32std.h>
|
|
24 |
#include <e32math.h>
|
|
25 |
|
|
26 |
// Some constants
|
|
27 |
const TUint KExpFlagSignMask = 0xFFFF0301;
|
|
28 |
|
|
29 |
// Structure definitions
|
|
30 |
struct SRealX
|
|
31 |
{
|
|
32 |
SRealX() {}
|
|
33 |
SRealX(TUint a, TUint b, TUint c);
|
|
34 |
SRealX(const TRealX& aRealX);
|
|
35 |
SRealX& operator=(const TRealX& aRealX);
|
|
36 |
operator TRealX() const;
|
|
37 |
TBool operator==(const SRealX& aSRealX) const;
|
|
38 |
|
|
39 |
TUint iExpFlagSign;
|
|
40 |
TUint iMantHigh;
|
|
41 |
TUint iMantLow;
|
|
42 |
};
|
|
43 |
|
|
44 |
enum TConversionFrom32Bits
|
|
45 |
{
|
|
46 |
EConstructInt=0, EAssignInt=1, ESetInt=2,
|
|
47 |
EConstructUint=3, EAssignUint=4, ESetUint=5,
|
|
48 |
EConstructFloat=6, EAssignFloat=7, ESetFloat=8
|
|
49 |
};
|
|
50 |
|
|
51 |
struct SConvertFrom32BitTest
|
|
52 |
{
|
|
53 |
SConvertFrom32BitTest(TInt op, const SRealX& res, TInt r);
|
|
54 |
void Test(TConversionFrom32Bits aConversion) const;
|
|
55 |
|
|
56 |
TInt iOperand;
|
|
57 |
SRealX iResult;
|
|
58 |
TInt iReturnCode;
|
|
59 |
};
|
|
60 |
|
|
61 |
enum TConversionFrom64Bits
|
|
62 |
{
|
|
63 |
EConstructInt64=0, EAssignInt64=1, ESetInt64=2,
|
|
64 |
EConstructDouble=3, EAssignDouble=4, ESetDouble=5
|
|
65 |
};
|
|
66 |
|
|
67 |
struct SConvertFrom64BitTest
|
|
68 |
{
|
|
69 |
SConvertFrom64BitTest(TInt64 op, const SRealX& res, TInt r);
|
|
70 |
void Test(TConversionFrom64Bits aConversion) const;
|
|
71 |
|
|
72 |
TInt64 iOperand;
|
|
73 |
SRealX iResult;
|
|
74 |
TInt iReturnCode;
|
|
75 |
};
|
|
76 |
|
|
77 |
enum TConversionTo32Bits
|
|
78 |
{
|
|
79 |
EOperatorInt=0, EOperatorUint=1,
|
|
80 |
EOperatorTReal32=2, EGetTReal32=3
|
|
81 |
};
|
|
82 |
|
|
83 |
struct SConvertTo32BitTest
|
|
84 |
{
|
|
85 |
SConvertTo32BitTest(const SRealX& op, TInt res, TInt r);
|
|
86 |
void Test(TConversionTo32Bits aConversion) const;
|
|
87 |
|
|
88 |
SRealX iOperand;
|
|
89 |
TInt iResult;
|
|
90 |
TInt iReturnCode;
|
|
91 |
};
|
|
92 |
|
|
93 |
enum TConversionTo64Bits
|
|
94 |
{
|
|
95 |
EOperatorInt64=0,
|
|
96 |
EOperatorTReal64=1, EGetTReal64=2
|
|
97 |
};
|
|
98 |
|
|
99 |
struct SConvertTo64BitTest
|
|
100 |
{
|
|
101 |
SConvertTo64BitTest(const SRealX& op, TInt64 res, TInt r);
|
|
102 |
void Test(TConversionTo64Bits aConversion) const;
|
|
103 |
|
|
104 |
SRealX iOperand;
|
|
105 |
TInt64 iResult;
|
|
106 |
TInt iReturnCode;
|
|
107 |
};
|
|
108 |
|
|
109 |
enum TUnaryOperation
|
|
110 |
{
|
|
111 |
EUnaryPlus=0, EUnaryMinus=1,
|
|
112 |
EPreInc=2, EPreDec=3, EPostInc=4, EPostDec=5
|
|
113 |
};
|
|
114 |
|
|
115 |
struct SOneOpTest
|
|
116 |
{
|
|
117 |
SOneOpTest(const SRealX& op, const SRealX& res, TInt r);
|
|
118 |
void Test(TUnaryOperation anOperation) const;
|
|
119 |
TInt DoTest(TUnaryOperation anOperation, TRealX *aResult) const;
|
|
120 |
|
|
121 |
SRealX iOperand;
|
|
122 |
SRealX iResult;
|
|
123 |
TInt iReturnCode;
|
|
124 |
};
|
|
125 |
|
|
126 |
struct SOneOpTestThreadInfo
|
|
127 |
{
|
|
128 |
const SOneOpTest *iTest;
|
|
129 |
TUnaryOperation iOperation;
|
|
130 |
TRealX *iResult;
|
|
131 |
};
|
|
132 |
|
|
133 |
struct SCompareTest
|
|
134 |
{
|
|
135 |
SCompareTest(const SRealX& o1, const SRealX& o2, TInt r);
|
|
136 |
void Test() const;
|
|
137 |
|
|
138 |
SRealX iOperand1;
|
|
139 |
SRealX iOperand2;
|
|
140 |
TInt iReturnCode;
|
|
141 |
};
|
|
142 |
|
|
143 |
enum TBinaryOperation
|
|
144 |
{
|
|
145 |
EAddEq=0, ESubEq=1, EMultEq=2, EDivEq=3, // TInt TRealX::AddEq() etc
|
|
146 |
EAdd=4, ESub=5, EMult=6, EDiv=7, // TInt TRealX::Add() etc
|
|
147 |
EPlusEq=8, EMinusEq=9, EStarEq=10, ESlashEq=11, // += -= *= /=
|
|
148 |
EPlus=12, EMinus=13, EStar=14, ESlash=15 // + - * /
|
|
149 |
};
|
|
150 |
|
|
151 |
struct STwoOpTest
|
|
152 |
{
|
|
153 |
STwoOpTest(const SRealX& o1, const SRealX& o2, const SRealX& res, TInt r);
|
|
154 |
void Test(TBinaryOperation anOperation, TBool aSwap=EFalse) const;
|
|
155 |
TInt DoTest(TBinaryOperation anOperation, TRealX *aResult, TBool aSwap) const;
|
|
156 |
|
|
157 |
SRealX iOperand1;
|
|
158 |
SRealX iOperand2;
|
|
159 |
SRealX iResult;
|
|
160 |
TInt iReturnCode;
|
|
161 |
};
|
|
162 |
|
|
163 |
struct STwoOpTestThreadInfo
|
|
164 |
{
|
|
165 |
const STwoOpTest *iTest;
|
|
166 |
TBinaryOperation iOperation;
|
|
167 |
TRealX *iResult;
|
|
168 |
TBool iSwap;
|
|
169 |
};
|
|
170 |
|
|
171 |
struct SSpecialValueTest
|
|
172 |
{
|
|
173 |
SSpecialValueTest(const SRealX& op, TInt aResults);
|
|
174 |
void Test() const;
|
|
175 |
|
|
176 |
SRealX iOperand;
|
|
177 |
TBool iIsZero;
|
|
178 |
TBool iIsNaN;
|
|
179 |
TBool iIsInfinite;
|
|
180 |
TBool iIsFinite;
|
|
181 |
};
|
|
182 |
|
|
183 |
GLREF_D const TInt NumBinaryOpNaNTests;
|
|
184 |
GLREF_D const STwoOpTest BinaryOpNaNTests[];
|
|
185 |
|
|
186 |
GLREF_D const TInt NumAdditionTests;
|
|
187 |
GLREF_D const STwoOpTest AdditionTests[];
|
|
188 |
|
|
189 |
GLREF_D const TInt NumMultiplicationTests;
|
|
190 |
GLREF_D const STwoOpTest MultiplicationTests[];
|
|
191 |
|
|
192 |
GLREF_D const TInt NumDivisionTests;
|
|
193 |
GLREF_D const STwoOpTest DivisionTests[];
|
|
194 |
|
|
195 |
GLREF_D const TInt NumComparisonTests;
|
|
196 |
GLREF_D const SCompareTest ComparisonTests[];
|
|
197 |
|
|
198 |
GLREF_D const TInt NumUnaryPlusTests;
|
|
199 |
GLREF_D const SOneOpTest UnaryPlusTests[];
|
|
200 |
|
|
201 |
GLREF_D const TInt NumUnaryMinusTests;
|
|
202 |
GLREF_D const SOneOpTest UnaryMinusTests[];
|
|
203 |
|
|
204 |
GLREF_D const TInt NumIncTests;
|
|
205 |
GLREF_D const SOneOpTest IncTests[];
|
|
206 |
|
|
207 |
GLREF_D const TInt NumDecTests;
|
|
208 |
GLREF_D const SOneOpTest DecTests[];
|
|
209 |
|
|
210 |
GLREF_D const TInt NumConvertFromIntTests;
|
|
211 |
GLREF_D const SConvertFrom32BitTest ConvertFromIntTests[];
|
|
212 |
|
|
213 |
GLREF_D const TInt NumConvertFromUintTests;
|
|
214 |
GLREF_D const SConvertFrom32BitTest ConvertFromUintTests[];
|
|
215 |
|
|
216 |
GLREF_D const TInt NumConvertFromFloatTests;
|
|
217 |
GLREF_D const SConvertFrom32BitTest ConvertFromFloatTests[];
|
|
218 |
|
|
219 |
GLREF_D const TInt NumConvertFromInt64Tests;
|
|
220 |
GLREF_D const SConvertFrom64BitTest ConvertFromInt64Tests[];
|
|
221 |
|
|
222 |
GLREF_D const TInt NumConvertFromDoubleTests;
|
|
223 |
GLREF_D const SConvertFrom64BitTest ConvertFromDoubleTests[];
|
|
224 |
|
|
225 |
GLREF_D const TInt NumConvertToIntTests;
|
|
226 |
GLREF_D const SConvertTo32BitTest ConvertToIntTests[];
|
|
227 |
|
|
228 |
GLREF_D const TInt NumConvertToUintTests;
|
|
229 |
GLREF_D const SConvertTo32BitTest ConvertToUintTests[];
|
|
230 |
|
|
231 |
GLREF_D const TInt NumConvertToInt64Tests;
|
|
232 |
GLREF_D const SConvertTo64BitTest ConvertToInt64Tests[];
|
|
233 |
|
|
234 |
GLREF_D const TInt NumConvertToFloatTests;
|
|
235 |
GLREF_D const SConvertTo32BitTest ConvertToFloatTests[];
|
|
236 |
|
|
237 |
GLREF_D const TInt NumConvertToDoubleTests;
|
|
238 |
GLREF_D const SConvertTo64BitTest ConvertToDoubleTests[];
|
|
239 |
|
|
240 |
GLREF_D const TInt NumSpecialValueTests;
|
|
241 |
GLREF_D const SSpecialValueTest SpecialValueTests[];
|
|
242 |
|
|
243 |
#endif
|