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