|
From: <and...@us...> - 2006-04-12 21:16:07
|
Revision: 1255 Author: andreradke Date: 2006-04-12 14:15:56 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1255&view=rev Log Message: ----------- Updated fUnit.testSuperStress.testFile to also test file.readWholeFile and file.writeWholeFile. Modified Paths: -------------- ODBs/trunk/frontierRoot/suites/fUnit/testSuperStress/testFile.fvc Modified: ODBs/trunk/frontierRoot/suites/fUnit/testSuperStress/testFile.fvc =================================================================== --- ODBs/trunk/frontierRoot/suites/fUnit/testSuperStress/testFile.fvc 2006-04-12 20:27:14 UTC (rev 1254) +++ ODBs/trunk/frontierRoot/suites/fUnit/testSuperStress/testFile.fvc 2006-04-12 21:15:56 UTC (rev 1255) @@ -1,4 +1,4 @@ -FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testFile +FrontierVcsFile:2:scpt:suites.fUnit.testSuperStress.testFile on testFile () { local (sysdisk, sysfolder, tmpfolder, f, finder, i); @@ -10,17 +10,17 @@ tmpfolder = file.getSpecialFolderPath (sysdisk, "temp", true)}; f = tmpfolder + "superstress" + random (1, infinity) + ".txt"; - bundle { \xC7path parsing + bundle { «path parsing local (finder = sysfolder + "Finder"); assertEqual(file.fileFromPath (finder), "Finder", "file.fileFromPath is broken."); assertEqual(file.folderFromPath (finder), sysfolder, "file.folderFromPath is broken."); assertEqual(file.volumeFromPath (finder), sysdisk, "file.volumeFromPath is broken.")}; - bundle { \xC7path char + bundle { «path char if system.environment.isMac { assertEqual (file.getPathChar (), ":", "file.getPathChar is broken")}; if system.environment.isWindows { assertEqual (file.getPathChar (), "\\", "file.getPathChar is broken")}}; - bundle { \xC7file.getPath, file.setPath + bundle { «file.getPath, file.setPath oldpath = file.getPath (); newpath = file.folderFromPath (Frontier.getFilePath ()); rootname = file.fileFromPath (Frontier.getFilePath ()); @@ -29,7 +29,7 @@ assertEqual(file.getPath(), newpath, "file.getPath is broken."); file.setPath (oldpath); assertEqual(file.getPath(), oldpath, "file.getPath is broken.")}; - bundle { \xC7file.exists, fileloop, file.getSystemDisk, file.isVolume + bundle { «file.exists, fileloop, file.getSystemDisk, file.isVolume ctfiles = 0; fileloop (fname in file.getSystemDisk ()) { assert(file.exists(fname)); @@ -38,14 +38,14 @@ assertEqual(file.filesInFolder(sysdisk, 1), ctfiles, "file.filesInFolder is broken."); ctvolumes = 0; - fileloop (fname in "") { \xC7test fileloop at the volume level + fileloop (fname in "") { «test fileloop at the volume level assert(file.exists(fname), "file.exists is broken."); assert(file.isVolume(fname), "file.isVolume is broken."); ctvolumes++}; assertEqual(file.countVolumes(), ctvolumes); assert(file.exists(sysfolder), "file.exists is broken."); assert(!file.exists(sysfolder + file.getPathChar () + "this file doesn't exist"), "file.exists is broken")}; - bundle { \xC7extended fileloop, file.visitFolder + bundle { «extended fileloop, file.visitFolder local (ctfiles1 = 0, ctfiles2 = 0, path); on countFiles (path) { if not file.isFolder (path) { @@ -55,7 +55,7 @@ fileloop (path in sysdisk, 2) { ctfiles2++}; assertEqual(ctfiles1, ctfiles2, "extended fileloop or file.visitFolder is broken")}; - bundle { \xC7file.new, file.created, file.modified + bundle { «file.new, file.created, file.modified file.new (f); assert(file.exists(f), "file.new is broken"); assert(!file.isFolder(f), "file.new created a folder (!)"); @@ -65,19 +65,19 @@ file.new (f); assert(number (now - file.created(f)) < 10, "file.created is broken."); assert(number (now - file.modified(f)) < 10, "file.modified is broken.")}; - bundle { \xC7file.isVisible, setVisible + bundle { «file.isVisible, setVisible assert(file.isVisible(Frontier.getProgramPath()), "file.isVisible is broken."); file.setVisible (f, false); assert(!file.isVisible(f), "file.setVisible is broken."); file.setVisible (f, true); assert(file.isVisible(f), "file.setVisible is broken.")}; - bundle { \xC7file.lock, islocked, unlock + bundle { «file.lock, islocked, unlock assert(!file.isLocked(f), "file.new created a locked file."); file.lock (f); assert(file.isLocked(f), "file.lock is broken"); file.unlock (f); assert(!file.isLocked(f), "file.unlock is broken.")}; - bundle { \xC7file reading/writing + bundle { «file reading/writing local (i); if file.exists (f) { file.delete (f)}; @@ -103,7 +103,19 @@ file.close (f); assertEqual(file.size(f), 10, "file.setEndOfFile is broken."); file.delete (f)}; - bundle { \xC7file.copy, file.size + bundle { «file read/write whole file + if file.exists (f) { + file.delete (f)}; + local (s = string.getRandomPassword (63)); + while (sizeOf (s) < 64 * 1024) { + s = s + s;}; + file.writeWholeFile (f, s); + assertEqual (file.size (f), sizeOf (s), "file.writeWholeFile is broken."); + local (s2); + s2 = string (file.readWholeFile (f)); + assertEqual (s, s2, "file.writeWholeFile or file.readWholeFile is broken."); + file.delete (f)}; + bundle { «file.copy, file.size local (fold = tmpfolder + "superstress" + random (1, infinity) + ".txt"); local (fnew = tmpfolder + "superstress" + random (1, infinity) + ".txt"); file.writeWholeFile (fold, string (startup.license)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |