kerneltest/f32test/server/t_gdir.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
--- a/kerneltest/f32test/server/t_gdir.cpp	Tue Aug 31 16:34:26 2010 +0300
+++ b/kerneltest/f32test/server/t_gdir.cpp	Wed Sep 01 12:34:56 2010 +0100
@@ -13,7 +13,6 @@
 // Description:
 //
 
-#define __E32TEST_EXTENSION__
 #include <f32file.h>
 #include <e32test.h>
 #include "t_server.h"
@@ -111,13 +110,13 @@
 	TPtrC fileName(aFileName.iFileName);
 	TAutoClose<RFile> file;
 	TInt r=file.iObj.Replace(TheFs,fileName,EFileWrite);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TPtrC8 uidBuf((TUint8*)&checkedUid,sizeof(TCheckedUid));
 	r=file.iObj.Write(uidBuf);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TPtrC8 contents(aFileName.iContents);
 	r=file.iObj.Write(contents);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	}
 
 LOCAL_C void createFile(TInt anIndex)
@@ -135,11 +134,11 @@
 //
 	TAutoClose<RFile> file;
 	TInt r=file.iObj.Replace(TheFs,fName,EFileWrite);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TBuf8<36> b((TUint8*)"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
 	b.SetLength(anIndex+1);
 	r=file.iObj.Write(b);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	}
 
 LOCAL_C void createDir(TInt anIndex)
@@ -156,7 +155,7 @@
     test.Next(mes);
 //
 	TInt r=TheFs.MkDir(dName);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	}
 
 LOCAL_C void testSetup()
@@ -168,7 +167,7 @@
 	test.Next(_L("Remove test directory"));
 	CDir* pD;
 	TInt r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,EDirsLast,pD);
-	test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrPathNotFound);
+	test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
 	if (r==KErrNone)
 		{
 		TInt count=pD->Count();
@@ -181,14 +180,14 @@
 				TFileName name;
 				name.Format(_L("%S%S\\"),&test_dir,&e.iName);
 				r=TheFs.RmDir(name);
-				test_KErrNone(r);
+				test(r==KErrNone);
 				}
 			else
 				{
 				TFileName name;
 				name.Format(_L("%S%S"),&test_dir,&e.iName);
 				r=TheFs.Delete(name);
-				test_KErrNone(r);
+				test(r==KErrNone);
 				}
 			}
 		}
@@ -217,28 +216,28 @@
 	test.Next(_L("Test directory handling"));
 	CDir* pD;
 	TInt r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,EDirsLast,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	displayDir(*pD,dCount,fCount);
 	test(dCount==4 && fCount==9);
 	delete pD;
 //
 	test.Next(_L("Attributes: NULL"));
 	r=TheFs.GetDir(test_dir_1,NULL,EDirsLast,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	displayDir(*pD,dCount,fCount);
 	test(dCount==0 && fCount==9);
 	delete pD;
 //
 	test.Next(_L("Attributes: KEntryAttDir & EDescending sort"));
 	r=TheFs.GetDir(test_dir_1,KEntryAttDir,ESortByName|EDescending,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	displayDir(*pD,dCount,fCount);
 	test(dCount==4 && fCount==9);
 	delete pD;
 //	
 	test.Next(_L("Attributes: Excl,Dir"));
 	r=TheFs.GetDir(test_dir_1,KEntryAttMatchExclusive|KEntryAttDir,ESortByName|EDescending,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	displayDir(*pD,dCount,fCount);
 	test(dCount==4 && fCount==0);
 	delete pD;
@@ -247,7 +246,7 @@
 //
 	test.Next(_L("Test split directories and files"));
 	r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,ESortByName,pD,pD2);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test.Printf(_L("FileList:\n"));
 	displayDir(*pD,dCount,fCount);
 	test(dCount==4 && fCount==9);
@@ -259,7 +258,7 @@
 //
 	test.Next(_L("Attributes: NULL"));
 	r=TheFs.GetDir(test_dir_1,NULL,ESortByName,pD,pD2);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test.Printf(_L("FileList:\n"));
 	displayDir(*pD,dCount,fCount);
 	test(dCount==0 && fCount==9);
@@ -271,7 +270,7 @@
 //
 	test.Next(_L("Attributes: KEntryAttDir"));
 	r=TheFs.GetDir(test_dir_1,KEntryAttDir,ESortByName,pD,pD2);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test.Printf(_L("FileList:\n"));
 	displayDir(*pD,dCount,fCount);
 	test(dCount==4 && fCount==9);
@@ -283,7 +282,7 @@
 //
 	test.Next(_L("Attributes: Excl,Dir"));
 	r=TheFs.GetDir(test_dir_1,KEntryAttMatchExclusive|KEntryAttDir,ESortByName,pD,pD2);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test.Printf(_L("FileList:\n"));
 	displayDir(*pD,dCount,fCount);
 	test(dCount==4 && fCount==0);
@@ -304,7 +303,7 @@
 	TInt dCount,fCount;
 	CDir* pD;
 	TInt r=TheFs.GetDir(_L("Z:\\*"),KEntryAttMaskSupported,EDirsFirst,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	displayDir(*pD,dCount,fCount);
 	delete pD;
 	}
@@ -318,7 +317,7 @@
 	test.Next(_L("Display contents of current directory"));
 	CDir* pD;
 	TInt r=TheFs.GetDir(gSessionPath,KEntryAttMaskSupported,EDirsFirst,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TInt dCount,fCount;
 	displayDir(*pD,dCount,fCount);
 	delete pD;
@@ -328,7 +327,7 @@
 	TBuf<16> noName=_L("asdf.idd");
 	parser.Set(session.Drive(),&noName,NULL);
 	r=TheFs.GetDir(parser.FullName(),KEntryAttMaskSupported,EDirsFirst,pD);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test(pD->Count()==0);
 	delete pD;
 	}
@@ -350,14 +349,14 @@
 
 	RFile f;
 	TInt r=f.Open(TheFs,entry.iName,EFileRead);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TBuf8<256> contents;
 	r=f.Read(sizeof(TCheckedUid),contents);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TPtrC8 uidFileContents(uidFiles[aUidFile].iContents);
 	test(contents==uidFileContents);
 	r=f.Read(contents);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test(contents.Length()==0);
 	f.Close();
 	}
@@ -390,7 +389,7 @@
 	TUidType matchUid(TUid::Null(),TUid::Uid(2),TUid::Null());
 	CDir* fileList;
 	TInt r=TheFs.GetDir(matchName,matchUid,EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TInt count=fileList->Count();
 	test(count==1);
 	MatchUidFile(0,0,fileList);
@@ -399,7 +398,7 @@
 	matchName=_L("*.*");
 	matchUid=TUidType(TUid::Uid(1),TUid::Uid(2),TUid::Uid(731));
 	r=TheFs.GetDir(matchName,matchUid,EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=fileList->Count();
 	test(count==1);
 	MatchUidFile(0,0,fileList);
@@ -408,7 +407,7 @@
 	matchName=_L("*.*");
 	matchUid=TUidType(TUid::Null(),TUid::Uid(2),TUid::Null());
 	r=TheFs.GetDir(matchName,matchUid,ESortByName|EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=fileList->Count();
 	test(count==3);
 	MatchUidFile(0,2,fileList);
@@ -419,7 +418,7 @@
 	matchName=_L("*.*");
 	matchUid=TUidType(TUid::Null(),TUid::Null(),TUid::Uid(731));
 	r=TheFs.GetDir(matchName,matchUid,ESortByName|EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=fileList->Count();
 	test(count==3);
 	MatchUidFile(2,0,fileList);
@@ -429,7 +428,7 @@
 
 	matchName=_L("*.*");
 	r=TheFs.GetDir(matchName,KEntryAttNormal,ESortByUid|EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=fileList->Count();
 	MatchUidFile(4,0,fileList);
 	MatchUidFile(1,1,fileList);
@@ -458,7 +457,7 @@
 	TUidType matchUid(TUid::Null(),TUid::Uid(0x1000008c),TUid::Null());
 	CDir* fileList;
 	TInt r=TheFs.GetDir(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("Z:\\SYS\\BIN\\"):_L("Z:\\SYSTEM\\BIN\\"),matchUid,EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TInt count=fileList->Count();
 #if defined(__WINS__)
 	test(count==0);
@@ -491,7 +490,7 @@
 	TUint onlyRO=KEntryAttReadOnly|KEntryAttMatchExclusive;
 	CDir* fileList;
 	TInt r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),onlyRO,EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TInt count=fileList->Count();
 	test(count==2);
 
@@ -505,7 +504,7 @@
 	test.Next(_L("Can match everything except read only files"));
 	TUint excludeRO=KEntryAttReadOnly|KEntryAttMatchExclude;
 	r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),excludeRO,EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=fileList->Count();
 	test(count==4);
 
@@ -522,7 +521,7 @@
 	test.Next(_L("Can match everything except system and readonly files"));
 	TUint excludeSystemAndRO=KEntryAttReadOnly|KEntryAttSystem|KEntryAttMatchExclude;
 	r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),excludeSystemAndRO,EAscending,fileList);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=fileList->Count();
 	test(count==2);
 
@@ -533,9 +532,9 @@
 	delete fileList;
 
 	r=TheFs.SetAtt(_L("\\F32-TST\\GDIR\\RONLY1.CCC"),0,KEntryAttReadOnly);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	r=TheFs.SetAtt(_L("\\F32-TST\\GDIR\\RONLY2.CCC"),0,KEntryAttReadOnly);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	}
 
 LOCAL_C void testGetHidden()
@@ -555,22 +554,22 @@
 	MakeDir(_L("\\F32-TST\\GDIR\\Dirhiddensystem.qqq\\"));
 
 	TInt r=TheFs.SetAtt(_L("FileHidden.qqq"),KEntryAttHidden,0);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	r=TheFs.SetAtt(_L("Filesystem.qqq"),KEntryAttSystem,0);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	r=TheFs.SetAtt(_L("FilehiddenSystem.qqq"),KEntryAttSystem|KEntryAttHidden,0);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	r=TheFs.SetAtt(_L("dirhidden.qqq"),KEntryAttHidden,0);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	r=TheFs.SetAtt(_L("dirsystem.qqq"),KEntryAttSystem,0);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	r=TheFs.SetAtt(_L("dirhiddensystem.qqq"),KEntryAttSystem|KEntryAttHidden,0);
-	test_KErrNone(r);
+	test(r==KErrNone);
 
 // Files and directories not hidden or system
 	CDir* dir;
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttDir,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	TInt count=dir->Count();
 	test(count==2);
 	TEntry entry;
@@ -582,7 +581,7 @@
 	
 // Files only
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttNormal,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==1);
 	entry=(*dir)[0];
@@ -591,7 +590,7 @@
 
 // Directories only
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==1);
 	entry=(*dir)[0];
@@ -600,7 +599,7 @@
 
 // Files + hidden
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==2);
 	entry=(*dir)[0];
@@ -611,7 +610,7 @@
 
 // Files + system
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==2);
 	entry=(*dir)[0];
@@ -622,7 +621,7 @@
 
 // Files + hidden + system
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==4);
 	entry=(*dir)[0];
@@ -637,7 +636,7 @@
 
 // Dirs + hidden
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==2);
 	entry=(*dir)[0];
@@ -648,7 +647,7 @@
 
 // Dirs + system
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttSystem|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==2);
 	entry=(*dir)[0];
@@ -659,7 +658,7 @@
 
 // Dirs + hidden + system
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==4);
 	entry=(*dir)[0];
@@ -675,7 +674,7 @@
 
 // Files + Dirs + hidden
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttDir,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==4);
 	entry=(*dir)[0];
@@ -690,7 +689,7 @@
 
 // Files + Dirs + system
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttSystem|KEntryAttDir,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==4);
 	entry=(*dir)[0];
@@ -705,7 +704,7 @@
 
 // Files + Dirs + hidden + system
 	r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem|KEntryAttDir,ESortByName,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	count=dir->Count();
 	test(count==8);
 	entry=(*dir)[0];
@@ -782,7 +781,7 @@
 	CDir* dir;
 	TUint sortOrder=ESortByName|EDirsFirst|EDescending;
 	TInt r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 //	TBuf8<16> result=_L("2,1,0,3,4,5");
 	TBuf<16> result=_L("2,1,0,3,4,5");
 
@@ -791,7 +790,7 @@
 // Test DirFirst - EAscending
 	sortOrder=ESortByName|EDirsFirst;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("3,4,5,0,1,2");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
@@ -799,14 +798,14 @@
 // Test DirLast - EDescending
 	sortOrder=ESortByName|EDirsLast|EDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("3,4,5,2,1,0");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
 // Test DirLast - EAscending
 	sortOrder=ESortByName|EDirsLast;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("0,1,2,3,4,5");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
@@ -814,14 +813,14 @@
 // Test DirFirst - EDirDescending
 	sortOrder=ESortByName|EDirsFirst|EDirDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("5,4,3,0,1,2");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
 // Test DirLast - EDirDescending
 	sortOrder=ESortByName|EDirsLast|EDirDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("0,1,2,5,4,3");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
@@ -829,14 +828,14 @@
 // Test DirFirst - EDescending|EDirDescending
 	sortOrder=ESortByName|EDirsFirst|EDescending|EDirDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("2,1,0,5,4,3");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
 // Test DirLast - EDescending|EDirDescending
 	sortOrder=ESortByName|EDirsLast|EDirDescending|EDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("5,4,3,2,1,0");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
@@ -844,21 +843,21 @@
 // Test DirNoOrder - EDescending|EDirDescending
 	sortOrder=ESortByName|EDescending|EDirDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("5,2,4,1,3,0");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
 // Test DirNoOrder - EDescending
 	sortOrder=ESortByName|EDescending;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("5,2,4,1,3,0");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
 // Test DirNoOrder - EAscending
 	sortOrder=ESortByName;
 	r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	result=_L("0,3,1,4,2,5");
 	TestDirDescendingOrder(result,*dir);
 	delete dir;
@@ -882,7 +881,7 @@
 	MakeFile(_L("\\F32-TST\\GDIR\\DEF122894\\Xxxxxxxx1.dat"));
 	CDir* dir;
 	TInt r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\DEF122894\\"),KEntryAttMaskSupported,ESortByName|EAscending,dir);
-	test_KErrNone(r);
+	test(r==KErrNone);
 	test(dir->Count() == 2);
 	TEntry entry1, entry2;
 	entry1 = (*dir)[0];