Update of /cvsroot/frontierkernel/odbs/frontierRoot/suites/fUnit/testSuperStress In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16428/testSuperStress Modified Files: Tag: fUnit_Suite-branch testExternalDatabaseAccess testFile testMisc Log Message: Fixed Windows bugs. Index: testExternalDatabaseAccess =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/fUnit/testSuperStress/Attic/testExternalDatabaseAccess,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** testExternalDatabaseAccess 18 Feb 2006 11:31:14 -0000 1.1.2.2 --- testExternalDatabaseAccess 18 Feb 2006 15:07:50 -0000 1.1.2.3 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testExternalDatabaseAccess ! on testExternalDatabaseAccess () { local (f = file.getSpecialFolderPath ("", "desktop folder", false) + "testing.root"); local (x, n, s = "scratchpad"); if not file.exists (f) { db.new (f)}; db.open (f, false); if not db.defined (f, s) { db.newTable (f, s)}; n = db.countItems (f, s); if n == 0 { db.setValue (f, s + ".test", user.prefs)}; s = s + '.' + db.getNthItem (f, s, 1); x = db.getValue (f, s); db.setValue (f, "scratchpad.bTable", x); db.save (f); db.close (f); db.open (f, true); x = db.getValue (f, "scratchpad.bTable"); db.close (f); file.delete (f); assertEqual(string(x), string(user.prefs), "The db verbs are broken.")}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testExternalDatabaseAccess ! on testExternalDatabaseAccess () { local (f); if system.environment.isMac { f = file.getSpecialFolderPath ("", "desktop folder", false)} else { f = file.getSpecialFolderPath ("", "desktop", false)}; f = f + "testing.root"; local (x, n, s = "scratchpad"); if not file.exists (f) { db.new (f)}; db.open (f, false); if not db.defined (f, s) { db.newTable (f, s)}; n = db.countItems (f, s); if n == 0 { db.setValue (f, s + ".test", user.prefs)}; s = s + '.' + db.getNthItem (f, s, 1); x = db.getValue (f, s); db.setValue (f, "scratchpad.bTable", x); db.save (f); db.close (f); db.open (f, true); x = db.getValue (f, "scratchpad.bTable"); db.close (f); file.delete (f); assertEqual(string(x), string(user.prefs), "The db verbs are broken.")}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} \ No newline at end of file Index: testMisc =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/fUnit/testSuperStress/Attic/testMisc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** testMisc 18 Feb 2006 11:27:24 -0000 1.1.2.2 --- testMisc 18 Feb 2006 15:07:50 -0000 1.1.2.3 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testMisc ! on testMisc () { Çmiscellaneous random stuff local (adrdata = @parentOf (this^)^.data); bundle { Çbinary values as arrays x = binary (0xaabbccdd); assert(x[1] == 0xaa and x[4] == 0xdd, "binary array indexing is broken"); on checkRange() { x[5]}; assertErrors(@checkRange, "out of range"); delete (@x [1]); delete (@x [1]); setBinaryType (@x, shortType); assertEqual(number(x), 0xccdd, "delete of binary array item is broken"); x [2] = 3; assertEqual(short(x), short(0xcc03), "binary array assignment is broken")}; bundle { Çscript.getCode on foo (x) { return (x)}; local (miscUserTalk); script.getCode (@adrdata^.miscUserTalk, @miscUserTalk); assertEqual(miscUserTalk(2, 3, 4), 14, "script.getCode is broken")}; bundle { Çtry out nested bundles bundle { Çcheck rects local (x, t, l, b, r); x = rectangle.set (10, 20, 30, 40); rectangle.get (x, @t, @l, @b, @r); assert(t == 10 and l == 20 and b == 30 and r == 40, "Problems with rects. " + x)}; bundle { Çmess with keyboard local (s); s = ""; if kb.optionKey () { s = s + "opt "}; if kb.cmdKey () { s = s + "cmd "}; if kb.shiftKey () { s = s + "shift "}; if kb.controlKey () { s = s + "ctrl "}; };// no asserts in original superstress - Monday, October 04, 2004 at 6:45:46 PM by JPB bundle { Çcheck addresses local (adr); adr = address ("root.system"); assert(sizeOf(adr^) > 0, "Something's wrong with addresses.")}; bundle { Çcheck targeting if not Frontier.isRuntime () { if defined (root.examples.list2) { target.set (@root.examples.list2); op.firstSummit (); assertEqual(op.getLineText(), "Nebraska", "Something's wrong with targeting."); assertEqual(target.get(), @root.examples.list2, "Something's wrong with targeting."); target.clear (); assertNotEqual(target.get(), @root.examples.list2, "Something's wrong with targeting.")}}}; ÇmyMoof (5, 1) // don't know what this is - Monday, October 04, 2004 at 6:47:02 PM by JPB bundle { Çtable surgery local (adr); adr = @scratchpad.tableTesting; assert(new(tableType, adr)); assert(defined(adr^), "new verb didn't create anything"); assertEqual(typeOf(adr^), tableType, "new didn't create a table."); delete (adr); assert(!defined(adr^), "delete didn't delete " + adr)}; bundle { Çcheck typeOf assertEqual(typeOf(root), tableType, "typeOf has a problem"); assertEqual(typeOf(user.prefs["name"]), stringType, "typeOf has a problem."); assertEqual(typeOf(examples.yesterday), dateType, "typeOf has a problem")}; bundle { Çcheck evaluate assertEqual(evaluate("12 + 24 + abs (-12)"), 48, "evaluate has a problem")}}; bundle { Çcheck addressing modes & case insenstivity assertEqual(@user.prefs ["name"], @User.prefs.Name, "array operations are broken"); assertEqual((@uSEr.prefs.NamE)^, user.Prefs.name, "dereferencing is broken"); assertEqual((@user)^.Prefs ["name"], uSEr.pRefs.NamE, "dereferencing or array is broken"); assertEqual(user.prefs.["name"], user.prefs.NAME, "bracketed expressions are broken")}; bundle { Çcheck with statement table.surePath ("temp.foo.test.xyzzy"); temp.foo.test.xyzzy = 5; with temp { with foo { with test { assertEqual(xyzzy, 5, "with statement is broken")}}}; with temp, foo, test { delete (@xyzzy)}; delete (@temp.foo)}; states.looper (); assertEqual(states.nthState(45), "Vermont", "states.nthState is broken."); if system.environment.isMacOsClassic { local (x, y); x = number (callXCMD (@adrdata^.miscXCMD)); y = sys.memAvail (); if x != y { scriptError ("callXCMD or sys.memAvail is broken.")}}; bundle { Çtest semophores local (locked); semaphores.lock ("testing", 0); try { semaphores.lock ("testing", 6); locked = false} else { locked = true}; assert(locked, "semaphores.lock is broken"); assert(semaphores.unlock("testing"), "semaphores.unlock is broken")}}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testMisc ! on testMisc () { Çmiscellaneous random stuff local (adrdata = @parentOf (this^)^.data); bundle { Çbinary values as arrays x = binary (0xaabbccdd); assert(x[1] == 0xaa and x[4] == 0xdd, "binary array indexing is broken"); on checkRange() { x[5]}; assertErrors(@checkRange, "out of range"); delete (@x [1]); delete (@x [1]); setBinaryType (@x, shortType); assertEqual(number(x), 0xccdd, "delete of binary array item is broken"); x [2] = 3; assertEqual(short(x), short(0xcc03), "binary array assignment is broken")}; bundle { Çscript.getCode on foo (x) { return (x)}; local (miscUserTalk); script.getCode (@adrdata^.miscUserTalk, @miscUserTalk); assertEqual(miscUserTalk(2, 3, 4), 14, "script.getCode is broken")}; bundle { Çtry out nested bundles bundle { Çcheck rects local (x, t, l, b, r); x = rectangle.set (10, 20, 30, 40); rectangle.get (x, @t, @l, @b, @r); assert(t == 10 and l == 20 and b == 30 and r == 40, "Problems with rects. " + x)}; bundle { Çmess with keyboard local (s); s = ""; if kb.optionKey () { s = s + "opt "}; if kb.cmdKey () { s = s + "cmd "}; if kb.shiftKey () { s = s + "shift "}; if kb.controlKey () { s = s + "ctrl "}; };// no asserts in original superstress - Monday, October 04, 2004 at 6:45:46 PM by JPB bundle { Çcheck addresses local (adr); adr = address ("root.system"); assert(sizeOf(adr^) > 0, "Something's wrong with addresses.")}; bundle { Çcheck targeting if not Frontier.isRuntime () { if defined (root.examples.list2) { target.set (@root.examples.list2); op.firstSummit (); assertEqual(op.getLineText(), "Nebraska", "Something's wrong with targeting."); assertEqual(target.get(), @root.examples.list2, "Something's wrong with targeting."); target.clear (); assertNotEqual(target.get(), @root.examples.list2, "Something's wrong with targeting.")}}}; ÇmyMoof (5, 1) // don't know what this is - Monday, October 04, 2004 at 6:47:02 PM by JPB bundle { Çtable surgery local (adr); adr = @scratchpad.tableTesting; assert(new(tableType, adr)); assert(defined(adr^), "new verb didn't create anything"); assertEqual(typeOf(adr^), tableType, "new didn't create a table."); delete (adr); assert(!defined(adr^), "delete didn't delete " + adr)}; bundle { Çcheck typeOf assertEqual(typeOf(root), tableType, "typeOf has a problem"); assertEqual(typeOf(user.prefs["name"]), stringType, "typeOf has a problem."); assertEqual(typeOf(examples.yesterday), dateType, "typeOf has a problem")}; bundle { Çcheck evaluate assertEqual(evaluate("12 + 24 + abs (-12)"), 48, "evaluate has a problem")}}; bundle { Çcheck addressing modes & case insenstivity assertEqual(@user.prefs ["name"], @User.prefs.Name, "array operations are broken"); assertEqual((@uSEr.prefs.NamE)^, user.Prefs.name, "dereferencing is broken"); assertEqual((@user)^.Prefs ["name"], uSEr.pRefs.NamE, "dereferencing or array is broken"); assertEqual(user.prefs.["name"], user.prefs.NAME, "bracketed expressions are broken")}; bundle { Çcheck with statement table.surePath ("temp.foo.test.xyzzy"); temp.foo.test.xyzzy = 5; with temp { with foo { with test { assertEqual(xyzzy, 5, "with statement is broken")}}}; with temp, foo, test { delete (@xyzzy)}; delete (@temp.foo)}; states.looper (); assertEqual(states.nthState(45), "Vermont", "states.nthState is broken."); if system.environment.isMac and system.environment.isMacOsClassic { local (x, y); x = number (callXCMD (@adrdata^.miscXCMD)); y = sys.memAvail (); if x != y { scriptError ("callXCMD or sys.memAvail is broken.")}}; bundle { Çtest semaphores local (locked); semaphores.lock ("testing", 0); try { semaphores.lock ("testing", 6); locked = false} else { locked = true}; assert(locked, "semaphores.lock is broken"); assert(semaphores.unlock("testing"), "semaphores.unlock is broken")}}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} \ No newline at end of file Index: testFile =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/fUnit/testSuperStress/Attic/testFile,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** testFile 18 Feb 2006 12:14:30 -0000 1.1.2.1 --- testFile 18 Feb 2006 15:07:50 -0000 1.1.2.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testFile ! on testFile () { local (sysdisk, sysfolder, tmpfolder, f, finder, i); sysdisk = file.getSystemDisk (); sysfolder = file.getSystemFolderPath (); if system.environment.isMac { tmpfolder = file.getSpecialFolderPath (sysdisk, "Temporary Items", true)} else { tmpfolder = file.getSpecialFolderPath (sysdisk, "temp", true)}; f = tmpfolder + "superstress test file #23.txt"; 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 { Ç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 { Çfile.getPath, file.setPath oldpath = file.getPath (); newpath = file.folderFromPath (Frontier.getFilePath ()); rootname = file.fileFromPath (Frontier.getFilePath ()); file.setPath (newpath); assert(file.exists(rootname), "file.setPath is broken"); assertEqual(file.getPath(), newpath, "file.getPath is broken."); file.setPath (oldpath); assertEqual(file.getPath(), oldpath, "file.getPath is broken.")}; bundle { Çfile.exists, fileloop, file.getSystemDisk, file.isVolume ctfiles = 0; fileloop (fname in file.getSystemDisk ()) { assert(file.exists(fname)); assert(!file.isVolume(fname), "file.isVolume is broken."); ctfiles++}; assertEqual(file.filesInFolder(sysdisk, 1), ctfiles, "file.filesInFolder is broken."); ctvolumes = 0; 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 { Çextended fileloop, file.visitFolder local (ctfiles1 = 0, ctfiles2 = 0, path); on countFiles (path) { if not file.isFolder (path) { ctfiles1++}; return (true)}; file.visitFolder (sysdisk, 2, @countFiles); fileloop (path in sysdisk, 2) { ctfiles2++}; assertEqual(ctfiles1, ctfiles2, "extended fileloop or file.visitFolder is broken")}; 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 (!)"); file.delete (f); assert(!file.exists(f), "file.delete is broken"); file.new (f); now = clock.now (); assert(now - file.created(f) < 1, "file.created is broken."); assert(now - file.modified(f) < 1, "file.modified is broken.")}; 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 { Ç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 { Çfile.copy, file.size local (fold = Frontier.getFilePath ()); local (fnew = tmpfolder + "superstress.root"); file.copy (fold, fnew); assert(file.exists(fnew), "file.copy is broken"); assertEqual(file.size(fnew), file.size(fold), "file.copy or file.size is broken."); assert(file.compare(fold, fnew), "file.copy is broken."); file.delete (fnew)}; bundle { Çfile reading/writing local (path, i); path = tmpfolder + "superstress.states.txt"; if file.exists (path) { file.delete (path)}; file.new (path); for i = 1 to 50 { file.writeLine (path, states.nthState (i))}; file.open (path); i = 1; while (not file.endOfFile (path)) { assertEqual(file.readLine(path), states.nthState(i), "File reading/writing is broken."); i++}; bundle { //test 5.0.1 verbs local (eol, eof = file.getEndOfFile (path)); local (x, s = states.nthState (50)); if system.environment.isMac { eol = "\r"} else { eol = "\r\n"}; file.setPosition (path, eof - string.length (s + eol)); x = file.read (path, string.length (s)); assertEqual(string(x), s, "File getEndOfFile or file.setPosition is broken. \"" + x + "\" != \"" + s + "\".")}; file.setEndOfFile (path, 10); file.close (path); assertEqual(file.size(path), 10, "file.setEndOfFile is broken."); file.delete (path)}; assert(file.delete(f), "file.delete is broken.")}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testFile ! on testFile () { local (sysdisk, sysfolder, tmpfolder, f, finder, i); sysdisk = file.getSystemDisk (); sysfolder = file.getSystemFolderPath (); if system.environment.isMac { tmpfolder = file.getSpecialFolderPath (sysdisk, "Temporary Items", true)} else { tmpfolder = file.getSpecialFolderPath (sysdisk, "temp", true)}; f = tmpfolder + "superstress" + random (1, infinity) + ".txt"; 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 { Ç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 { Çfile.getPath, file.setPath oldpath = file.getPath (); newpath = file.folderFromPath (Frontier.getFilePath ()); rootname = file.fileFromPath (Frontier.getFilePath ()); file.setPath (newpath); assert(file.exists(rootname), "file.setPath is broken"); assertEqual(file.getPath(), newpath, "file.getPath is broken."); file.setPath (oldpath); assertEqual(file.getPath(), oldpath, "file.getPath is broken.")}; bundle { Çfile.exists, fileloop, file.getSystemDisk, file.isVolume ctfiles = 0; fileloop (fname in file.getSystemDisk ()) { assert(file.exists(fname)); assert(!file.isVolume(fname), "file.isVolume is broken."); ctfiles++}; assertEqual(file.filesInFolder(sysdisk, 1), ctfiles, "file.filesInFolder is broken."); ctvolumes = 0; 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 { Çextended fileloop, file.visitFolder local (ctfiles1 = 0, ctfiles2 = 0, path); on countFiles (path) { if not file.isFolder (path) { ctfiles1++}; return (true)}; file.visitFolder (sysdisk, 2, @countFiles); fileloop (path in sysdisk, 2) { ctfiles2++}; assertEqual(ctfiles1, ctfiles2, "extended fileloop or file.visitFolder is broken")}; 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 (!)"); file.delete (f); assert(!file.exists(f), "file.delete is broken"); local (now = clock.now ()); 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 { Ç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 { Ç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 { Çfile reading/writing local (i); if file.exists (f) { file.delete (f)}; file.new (f); for i = 1 to 50 { file.writeLine (f, states.nthState (i))}; file.open (f); i = 1; while (not file.endOfFile (f)) { assertEqual(file.readLine(f), states.nthState(i), "File reading/writing is broken."); i++}; bundle { //test 5.0.1 verbs local (eol, eof = file.getEndOfFile (f)); local (x, s = states.nthState (50)); if system.environment.isMac { eol = "\r"} else { eol = "\r\n"}; file.setPosition (f, eof - string.length (s + eol)); x = file.read (f, string.length (s)); assertEqual(string(x), s, "File getEndOfFile or file.setPosition is broken. \"" + x + "\" != \"" + s + "\".")}; file.setEndOfFile (f, 10); file.close (f); assertEqual(file.size(f), 10, "file.setEndOfFile 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)); assertEqual(file.size(fold), string.length (string (startup.license)), "file.size is broken."); file.copy (fold, fnew); assert(file.exists(fnew), "file.copy is broken"); assertEqual(file.size(fnew), file.size(fold), "file.copy or file.size is broken."); assert(file.compare(fold, fnew), "file.copy is broken."); file.delete (fold); file.delete (fnew)}}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} \ No newline at end of file |