51 |
50 |
52 LOCAL_C void checkPattern() |
51 LOCAL_C void checkPattern() |
53 { |
52 { |
54 test.Printf(_L("Opening: %S\n"),&nameBuf1); |
53 test.Printf(_L("Opening: %S\n"),&nameBuf1); |
55 TInt r=file1.Open(TheFs,nameBuf1,EFileStream); |
54 TInt r=file1.Open(TheFs,nameBuf1,EFileStream); |
56 test_KErrNone(r); |
55 test(r==KErrNone); |
57 test.Printf(_L("Opening: %S\n"),&nameBuf2); |
56 test.Printf(_L("Opening: %S\n"),&nameBuf2); |
58 r=file2.Open(TheFs,nameBuf2,EFileStream); |
57 r=file2.Open(TheFs,nameBuf2,EFileStream); |
59 test_KErrNone(r); |
58 test(r==KErrNone); |
60 test.Printf(_L("Checking test pattern...\n")); |
59 test.Printf(_L("Checking test pattern...\n")); |
61 for (TInt i=0 ; i<nTimes ; i++) |
60 for (TInt i=0 ; i<nTimes ; i++) |
62 { |
61 { |
63 r=file1.Read(buf,len1); |
62 r=file1.Read(buf,len1); |
64 test_KErrNone(r); |
63 test(r==KErrNone); |
65 TInt j; |
64 TInt j; |
66 for (j=0 ; j< len1 ; j++) |
65 for (j=0 ; j< len1 ; j++) |
67 test(buf[j]==j); |
66 test(buf[j]==j); |
68 r=file2.Read(buf,len2); |
67 r=file2.Read(buf,len2); |
69 test_KErrNone(r); |
68 test(r==KErrNone); |
70 for (j=0 ; j< len2 ; j++) |
69 for (j=0 ; j< len2 ; j++) |
71 test(buf[j]=='A'); |
70 test(buf[j]=='A'); |
72 } |
71 } |
73 file1.Close(); |
72 file1.Close(); |
74 file2.Close(); |
73 file2.Close(); |
90 buf4.Append('C'); |
89 buf4.Append('C'); |
91 for (i=0 ; i<len5 ; i++) |
90 for (i=0 ; i<len5 ; i++) |
92 buf5.Append('D'); |
91 buf5.Append('D'); |
93 |
92 |
94 TInt r=file1.Create(TheFs,nameBuf1,EFileStream|EFileWrite); |
93 TInt r=file1.Create(TheFs,nameBuf1,EFileStream|EFileWrite); |
95 test_KErrNone(r); |
94 test(r==KErrNone); |
96 test.Printf(_L("Created: %S\n"),&nameBuf1); |
95 test.Printf(_L("Created: %S\n"),&nameBuf1); |
97 r=file2.Create(TheFs,nameBuf2,EFileStream|EFileWrite); |
96 r=file2.Create(TheFs,nameBuf2,EFileStream|EFileWrite); |
98 test_KErrNone(r); |
97 test(r==KErrNone); |
99 test.Printf(_L("Created: %S\n"),&nameBuf2); |
98 test.Printf(_L("Created: %S\n"),&nameBuf2); |
100 r=file3.Create(TheFs,nameBuf3,EFileStream|EFileWrite); |
99 r=file3.Create(TheFs,nameBuf3,EFileStream|EFileWrite); |
101 test_KErrNone(r); |
100 test(r==KErrNone); |
102 test.Printf(_L("Created: %S\n"),&nameBuf3); |
101 test.Printf(_L("Created: %S\n"),&nameBuf3); |
103 r=file4.Create(TheFs,nameBuf4,EFileStream|EFileWrite); |
102 r=file4.Create(TheFs,nameBuf4,EFileStream|EFileWrite); |
104 test_KErrNone(r); |
103 test(r==KErrNone); |
105 test.Printf(_L("Created: %S\n"),&nameBuf4); |
104 test.Printf(_L("Created: %S\n"),&nameBuf4); |
106 r=file5.Create(TheFs,nameBuf5,EFileStream|EFileWrite); |
105 r=file5.Create(TheFs,nameBuf5,EFileStream|EFileWrite); |
107 test_KErrNone(r); |
106 test(r==KErrNone); |
108 test.Printf(_L("Created: %S\n"),&nameBuf5); |
107 test.Printf(_L("Created: %S\n"),&nameBuf5); |
109 |
108 |
110 test.Next(_L("Writing test pattern...")); |
109 test.Next(_L("Writing test pattern...")); |
111 for (i=0 ; i<nTimes ; i++) |
110 for (i=0 ; i<nTimes ; i++) |
112 { |
111 { |
113 r=file1.Write(buf1,len1); |
112 r=file1.Write(buf1,len1); |
114 test_KErrNone(r); |
113 test(r==KErrNone); |
115 r=file2.Write(buf2,len2); |
114 r=file2.Write(buf2,len2); |
116 test_KErrNone(r); |
115 test(r==KErrNone); |
117 r=file3.Write(buf3,len3); |
116 r=file3.Write(buf3,len3); |
118 test_KErrNone(r); |
117 test(r==KErrNone); |
119 r=file4.Write(buf4,len4); |
118 r=file4.Write(buf4,len4); |
120 test_KErrNone(r); |
119 test(r==KErrNone); |
121 r=file5.Write(buf5,len5); |
120 r=file5.Write(buf5,len5); |
122 test_KErrNone(r); |
121 test(r==KErrNone); |
123 } |
122 } |
124 file1.Close(); |
123 file1.Close(); |
125 file2.Close(); |
124 file2.Close(); |
126 |
125 |
127 test.Next(_L("Check pattern")); |
126 test.Next(_L("Check pattern")); |
128 checkPattern(); |
127 checkPattern(); |
129 |
128 |
130 test.Next(_L("Delete")); |
129 test.Next(_L("Delete")); |
131 test.Printf(_L("Deleting: %S\n"),&nameBuf1); |
130 test.Printf(_L("Deleting: %S\n"),&nameBuf1); |
132 r=TheFs.Delete(nameBuf1); |
131 r=TheFs.Delete(nameBuf1); |
133 test_KErrNone(r); |
132 test(r==KErrNone); |
134 test.Printf(_L("Deleting: %S\n"),&nameBuf2); |
133 test.Printf(_L("Deleting: %S\n"),&nameBuf2); |
135 r=TheFs.Delete(nameBuf2); |
134 r=TheFs.Delete(nameBuf2); |
136 test_KErrNone(r); |
135 test(r==KErrNone); |
137 |
136 |
138 file3.Close(); |
137 file3.Close(); |
139 file4.Close(); |
138 file4.Close(); |
140 file5.Close(); |
139 file5.Close(); |
141 |
140 |
142 test.Printf(_L("Deleting: %S\n"),&nameBuf3); |
141 test.Printf(_L("Deleting: %S\n"),&nameBuf3); |
143 r=TheFs.Delete(nameBuf3); |
142 r=TheFs.Delete(nameBuf3); |
144 test_KErrNone(r); |
143 test(r==KErrNone); |
145 test.Printf(_L("Deleting: %S\n"),&nameBuf4); |
144 test.Printf(_L("Deleting: %S\n"),&nameBuf4); |
146 r=TheFs.Delete(nameBuf4); |
145 r=TheFs.Delete(nameBuf4); |
147 test_KErrNone(r); |
146 test(r==KErrNone); |
148 test.Printf(_L("Deleting: %S\n"),&nameBuf5); |
147 test.Printf(_L("Deleting: %S\n"),&nameBuf5); |
149 r=TheFs.Delete(nameBuf5); |
148 r=TheFs.Delete(nameBuf5); |
150 test_KErrNone(r); |
149 test(r==KErrNone); |
151 |
150 |
152 // test.Close(); |
151 // test.Close(); |
153 } |
152 } |
154 |
153 |