41 if ((numb&0x1f)==0) |
40 if ((numb&0x1f)==0) |
42 test.Printf(_L("%d\r"),numb); |
41 test.Printf(_L("%d\r"),numb); |
43 |
42 |
44 // Replace file and write data |
43 // Replace file and write data |
45 r=TheFile.Replace(TheFs,nameBuf1,EFileStream); |
44 r=TheFile.Replace(TheFs,nameBuf1,EFileStream); |
46 test_KErrNone(r); |
45 test(r==KErrNone); |
47 r=TheFile.Write(testPat1); |
46 r=TheFile.Write(testPat1); |
48 test_KErrNone(r); |
47 test(r==KErrNone); |
49 |
48 |
50 Mem::Copy(&buf[0],&numb,sizeof(TInt)); |
49 Mem::Copy(&buf[0],&numb,sizeof(TInt)); |
51 r=TheFile.Write(buf); |
50 r=TheFile.Write(buf); |
52 test_KErrNone(r); |
51 test(r==KErrNone); |
53 |
52 |
54 // Seek to 0 and check data |
53 // Seek to 0 and check data |
55 TInt pos=0; |
54 TInt pos=0; |
56 r=TheFile.Seek(ESeekStart,pos); |
55 r=TheFile.Seek(ESeekStart,pos); |
57 test_KErrNone(r); |
56 test(r==KErrNone); |
58 test(pos==0); |
57 test(pos==0); |
59 r=TheFile.Read(chkPat1,len); |
58 r=TheFile.Read(chkPat1,len); |
60 test_KErrNone(r); |
59 test(r==KErrNone); |
61 test(chkPat1==testPat1); |
60 test(chkPat1==testPat1); |
62 r=TheFile.Read(testBuf,sizeof(TInt)); |
61 r=TheFile.Read(testBuf,sizeof(TInt)); |
63 test_KErrNone(r); |
62 test(r==KErrNone); |
64 TInt chkNumb=*((TInt*)testBuf.Ptr()); |
63 TInt chkNumb=*((TInt*)testBuf.Ptr()); |
65 test(chkNumb==numb); |
64 test(chkNumb==numb); |
66 |
65 |
67 // Close, then re-open file and check data |
66 // Close, then re-open file and check data |
68 TheFile.Close(); |
67 TheFile.Close(); |
69 r=TheFile.Open(TheFs,nameBuf1,EFileStream); |
68 r=TheFile.Open(TheFs,nameBuf1,EFileStream); |
70 test_KErrNone(r); |
69 test(r==KErrNone); |
71 r=TheFile.Read(chkPat1,len); |
70 r=TheFile.Read(chkPat1,len); |
72 test_KErrNone(r); |
71 test(r==KErrNone); |
73 test(chkPat1==testPat1); |
72 test(chkPat1==testPat1); |
74 r=TheFile.Read(testBuf,sizeof(TInt)); |
73 r=TheFile.Read(testBuf,sizeof(TInt)); |
75 test_KErrNone(r); |
74 test(r==KErrNone); |
76 chkNumb=*((TInt*)testBuf.Ptr()); |
75 chkNumb=*((TInt*)testBuf.Ptr()); |
77 test(chkNumb==numb); |
76 test(chkNumb==numb); |
78 TheFile.Close(); |
77 TheFile.Close(); |
79 } |
78 } |
80 test.Printf(_L("\n")); |
79 test.Printf(_L("\n")); |
81 r=TheFs.Delete(nameBuf1); |
80 r=TheFs.Delete(nameBuf1); |
82 test_KErrNone(r); |
81 test(r==KErrNone); |
83 } |
82 } |
84 |
83 |
85 GLDEF_C void CallTestsL(void) |
84 GLDEF_C void CallTestsL(void) |
86 { |
85 { |
87 testPat1=_L8("TextProcessorPa"); |
86 testPat1=_L8("TextProcessorPa"); |