author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32test\manager\t_clobbr.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
18 |
#define __E32TEST_EXTENSION__ |
0 | 19 |
#include <f32file.h> |
20 |
#include <e32test.h> |
|
21 |
#include "t_server.h" |
|
22 |
||
23 |
GLDEF_D RTest test(_L("T_CLOBBR")); |
|
24 |
||
25 |
GLDEF_C void CallTestsL(void) |
|
26 |
// |
|
27 |
// Test writing to a file and changing its size |
|
28 |
// |
|
29 |
{ |
|
30 |
test.Next(_L("Write file & change size")); |
|
31 |
||
32 |
RFile file; |
|
33 |
TInt r=file.Replace(TheFs,_L("test.dat"),EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
test_KErrNone(r); |
0 | 35 |
|
36 |
r=file.Write(0,_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
37 |
test_KErrNone(r); |
0 | 38 |
TBuf8<0x40> buf1; |
39 |
r=file.Read(0,buf1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
test_Value(r, r == KErrNone&&buf1.Length()==36); |
0 | 41 |
if (buf1!=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) |
42 |
test.Printf(_L("1). *BAD*\n")); |
|
43 |
||
44 |
r=file.SetSize(511); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
test_KErrNone(r); |
0 | 46 |
TBuf8<0x40> buf2; |
47 |
r=file.Read(0,buf2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
test_Value(r, r == KErrNone&&buf2.Length()==0x40); |
0 | 49 |
buf2.SetLength(36); |
50 |
if (buf2!=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) |
|
51 |
test.Printf(_L("2). *BAD*\n")); |
|
52 |
||
53 |
r=file.SetSize(512); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
test_KErrNone(r); |
0 | 55 |
TBuf8<0x40> buf3; |
56 |
r=file.Read(0,buf3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
test_Value(r, r == KErrNone&&buf3.Length()==0x40); |
0 | 58 |
buf3.SetLength(36); |
59 |
if (buf3!=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) |
|
60 |
test.Printf(_L("3). *BAD*\n")); |
|
61 |
||
62 |
r=file.Write(0,_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
test_KErrNone(r); |
0 | 64 |
TBuf8<0x40> buf4; |
65 |
r=file.Read(0,buf4); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
test_Value(r, r == KErrNone&&buf4.Length()==0x40); |
0 | 67 |
buf4.SetLength(36); |
68 |
if (buf4!=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) |
|
69 |
test.Printf(_L("4). *BAD*\n")); |
|
70 |
r=file.SetSize(511); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
test_KErrNone(r); |
0 | 72 |
TBuf8<0x40> buf5; |
73 |
r=file.Read(0,buf5); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
test_Value(r, r == KErrNone&&buf5.Length()==0x40); |
0 | 75 |
buf5.SetLength(36); |
76 |
if (buf5!=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) |
|
77 |
test.Printf(_L("5). *BAD*\n")); |
|
78 |
r=file.SetSize(512); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
test_KErrNone(r); |
0 | 80 |
TBuf8<0x40> buf6; |
81 |
r=file.Read(0,buf6); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
test_Value(r, r == KErrNone&&buf6.Length()==0x40); |
0 | 83 |
buf6.SetLength(36); |
84 |
if (buf6!=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")) |
|
85 |
test.Printf(_L("6). *BAD*\n")); |
|
86 |
// |
|
87 |
||
88 |
#if !defined(_UNICODE) |
|
89 |
test.Printf(_L("\n")); |
|
90 |
test.Printf(_L("1). %S\n"),&buf1); |
|
91 |
test.Printf(_L("2). %S\n"),&buf2); |
|
92 |
test.Printf(_L("3). %S\n"),&buf3); |
|
93 |
test.Printf(_L("4). %S\n"),&buf4); |
|
94 |
test.Printf(_L("5). %S\n"),&buf5); |
|
95 |
test.Printf(_L("6). %S\n"),&buf6); |
|
96 |
#endif |
|
97 |
file.Close(); |
|
98 |
} |