Update contrib.
1 // Copyright (c) 1996-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\server\b_mtst.cpp
15 // Tests file deleteing
23 RTest test(_L("B_MTST"));
33 GLDEF_D TBuf8<0x200> buf;
34 GLDEF_D TBuf8<0x200> buf1;
35 GLDEF_D TBuf8<0x200> buf2;
36 GLDEF_D TBuf8<0x200> buf3;
37 GLDEF_D TBuf8<0x200> buf4;
38 GLDEF_D TBuf8<0x200> buf5;
39 GLDEF_D TFileName nameBuf1=_L("B_MTST File 1");
40 GLDEF_D TFileName nameBuf2=_L("B_MTST File 2");
41 GLDEF_D TFileName nameBuf3=_L("B_MTST File 3");
42 GLDEF_D TFileName nameBuf4=_L("B_MTST File 4");
43 GLDEF_D TFileName nameBuf5=_L("B_MTST File 5");
51 LOCAL_C void checkPattern()
53 test.Printf(_L("Opening: %S\n"),&nameBuf1);
54 TInt r=file1.Open(TheFs,nameBuf1,EFileStream);
56 test.Printf(_L("Opening: %S\n"),&nameBuf2);
57 r=file2.Open(TheFs,nameBuf2,EFileStream);
59 test.Printf(_L("Checking test pattern...\n"));
60 for (TInt i=0 ; i<nTimes ; i++)
62 r=file1.Read(buf,len1);
65 for (j=0 ; j< len1 ; j++)
67 r=file2.Read(buf,len2);
69 for (j=0 ; j< len2 ; j++)
77 GLDEF_C void CallTestsL(void)
80 test.Next(_L("Generate test patterns"));
82 for (i=0 ; i<len1 ; i++)
83 buf1.Append((TUint8)i);
84 for (i=0 ; i<len2 ; i++)
86 for (i=0 ; i<len3 ; i++)
88 for (i=0 ; i<len4 ; i++)
90 for (i=0 ; i<len5 ; i++)
93 TInt r=file1.Create(TheFs,nameBuf1,EFileStream|EFileWrite);
95 test.Printf(_L("Created: %S\n"),&nameBuf1);
96 r=file2.Create(TheFs,nameBuf2,EFileStream|EFileWrite);
98 test.Printf(_L("Created: %S\n"),&nameBuf2);
99 r=file3.Create(TheFs,nameBuf3,EFileStream|EFileWrite);
101 test.Printf(_L("Created: %S\n"),&nameBuf3);
102 r=file4.Create(TheFs,nameBuf4,EFileStream|EFileWrite);
104 test.Printf(_L("Created: %S\n"),&nameBuf4);
105 r=file5.Create(TheFs,nameBuf5,EFileStream|EFileWrite);
107 test.Printf(_L("Created: %S\n"),&nameBuf5);
109 test.Next(_L("Writing test pattern..."));
110 for (i=0 ; i<nTimes ; i++)
112 r=file1.Write(buf1,len1);
114 r=file2.Write(buf2,len2);
116 r=file3.Write(buf3,len3);
118 r=file4.Write(buf4,len4);
120 r=file5.Write(buf5,len5);
126 test.Next(_L("Check pattern"));
129 test.Next(_L("Delete"));
130 test.Printf(_L("Deleting: %S\n"),&nameBuf1);
131 r=TheFs.Delete(nameBuf1);
133 test.Printf(_L("Deleting: %S\n"),&nameBuf2);
134 r=TheFs.Delete(nameBuf2);
141 test.Printf(_L("Deleting: %S\n"),&nameBuf3);
142 r=TheFs.Delete(nameBuf3);
144 test.Printf(_L("Deleting: %S\n"),&nameBuf4);
145 r=TheFs.Delete(nameBuf4);
147 test.Printf(_L("Deleting: %S\n"),&nameBuf5);
148 r=TheFs.Delete(nameBuf5);