diff -r 000000000000 -r a41df078684a kerneltest/f32test/math/t_gen32.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/f32test/math/t_gen32.cpp Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,313 @@ +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// f32test\math\t_gen32.cpp +// Generates files to be used in testing whether arithmetic in TReal32 gives +// exactly the same results using the MSDEV complier as on the rack. +// +// + +#include +#include +#include "t_math.h" +#include "../server/t_server.h" + +#if defined(__VC32__) +// +// Some symbols generated by the VC++ compiler for floating point stuff. +// +extern "C" { +GLDEF_D TInt _adj_fdiv_m32; +} +#endif + +GLDEF_D RTest test(_L("T_GEN32")); + +LOCAL_D RFile f; +LOCAL_D const TFileName fileName32 = _L("T_REAL32.H"); + +LOCAL_D const TFileName pathName = _L("C:\\E32-MATH\\"); +LOCAL_D TBuf<0x100> buf; +LOCAL_D TBuf8<0x100> buf8; + +// Data for tests from T_R32DTA.cpp +GLREF_D TReal32 addInput[]; +GLREF_D TReal32 subInput[]; +GLREF_D TReal32 multInput[]; +GLREF_D TReal32 divInput[]; +//GLREF_D TApprox32 subApprox[]; +GLREF_D TReal32 unaryInput[]; +GLREF_D TReal32 incDecInput[]; +GLREF_D TInt sizeAdd; +GLREF_D TInt sizeSub; +GLREF_D TInt sizeMult; +GLREF_D TInt sizeDiv; +//GLREF_D TInt sizeSubApprox; +GLREF_D TInt sizeUnary; +GLREF_D TInt sizeIncDec; + +LOCAL_C void appendStart() + { + f.Write(_L8("// Generated by \\E32\\TMATH\\T_GEN32.MAK\n\n")); + f.Write(_L8("#include \n\n")); + f.Write(_L8("#if defined(__WINS__)\n#include \"t_vals.hwg\"\n")); + f.Write(_L8("#else\n#include \"t_vals.hag\"\n#endif\n")); + } + +LOCAL_C void appendArrayName32(TPtrC aName) + { + buf=_L(""); + buf.AppendFormat(_L("const TInt32x %S[] = \n{\n"),&aName); + buf8.Copy(buf); + f.Write(buf8); + } + +LOCAL_C void appendValue32(TReal32* aVal) + { + buf=_L(""); + buf.AppendFormat(_L(" TInt32x(0x%x),\n"),*(TUint32*)aVal); + buf8.Copy(buf); + f.Write(buf8); + } + +LOCAL_C void appendArrayTerm() + { + buf8=_L8("};\n\n"); + f.Write(buf8); + } + +LOCAL_C void createAddArray() +// +// Writes an array of results of additions to the header file +// + { + TInt ii; + TReal32 ff; + + appendArrayName32(_L("addArray")); + for (ii=0; ii