Update of /cvsroot/frontierkernel/odbs/frontierRoot/suites/fUnit/testSuperStress In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27969/testSuperStress Added Files: description name testCase testClock testExternalDatabaseAccess testFile testGarbageCollection testLists testLocalDatabaseAccess testLocals testLoops testMacFileHandling testMath testMisc testNesting testObjects testOp testRegularExpressions testSizeOf testString testSys testThreads testTryElse testTypeOf testXML Log Message: Merge changes from fUnit_Suite-branch. --- NEW FILE: testXML --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testLocals --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testLocals on testLocals () { local (a = 1, b = 2, c = 3); bundle { local (a = 4, b = 5, c = 6); assertEqual(a+b+c, 15, "a+b+c should equal 15. Instead it equals " + (a+b+c) + ".")}; assertEqual(a+b+c, 6, "a+b+c should equal 6. Instead it equals " + (a+b+c) + ".")} --- NEW FILE: testFile --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testClock --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testSizeOf --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testSizeOf on testSizeOf () { local (e = "sizeof is broken."); assertEqual(sizeof('A'), 1, e); assertEqual(sizeof('XXXX'), 4, e); assertEqual(sizeof(true), 1, e); assertEqual(sizeof(number(1)), 4, e); assertEqual(sizeof("123456789"), 9, e); assertEqual(sizeof(clock.now()), 4, e); assertEqual(sizeof(up), 1, e); assertEqual(sizeof(@system.misc), 11, e); assertEqual(sizeof(point.set(12, 24)), 4, e); assertEqual(sizeof(single(1)), 4, e); if system.environment.isMac { assertEqual(sizeof(double(2)), 8, e); assertEqual(sizeof(fixed), 2, e); assertEqual(sizeof(rectangle.set(12, 24, 36, 48)), 8, e)}; if system.environment.isWindows { assertEqual(sizeof(double(2)), 10, e)}}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} --- NEW FILE: testString --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testMacFileHandling --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testMisc --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testMath --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testRegularExpressions --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testRegularExpressions on testRegularExpressions () { assert (defined (system.compiler.["kernel"].re), "The regular expressions verbs are not implemented in this application."); bundle { //re.match local (cp, matchInfo, s1 = "a123four", s2 = "bop bebe bop"); cp = re.compile ("[a-zA-Z]+[0-9]+"); assert (re.match (cp, s1, adrMatchInfoTable:@matchInfo), "re.match is broken."); assertEqual (matchInfo.matchString, "a123", "re.match is broken."); cp = re.compile ("(be){1,2}"); assert (re.match (cp, s2, adrMatchInfoTable:@matchInfo), "re.search is broken."); assertEqual (matchInfo.matchString, "bebe", "re.search is broken.")}; bundle { //re.extract local { cp; complexLinkPat = "<a[ \t\r\n]*[^>]*href[ \t\r\n]*=[ \t\r\n]*\"?([-_~%@:/\\.A-Za-z0-9]+)\"?[^>]*>([^<]*)"; simpleLinkPat = "<a[ \t\r\n]+[^>]*href[ \t\r\n]*=[ \t\r\n]*\"([^\"]*)\"[^>]*>([^<]*)"; s = string (re.testing.data.html); theList}; cp = re.compile (simpleLinkPat); theList = re.extract (cp, s, {2,1}); assertEqual (sizeOf (theList), 59, "re.extract is broken."); assertEqual (theList[57][1] , "Roget's Thesaurus:", "re.extract is broken."); assertEqual (theList[57][2] , "http://www2.thesaurus.com/thesaurus/", "re.extract is broken."); cp = re.compile (complexLinkPat); theList = re.extract (cp, s, {2,1}); assertEqual (sizeOf (theList), 59, "re.extract is broken."); assertEqual (theList[25][1] , "FileMaker", "re.extract is broken."); assertEqual (theList[25][2] , "http://www.scripting.com/apps/filemaker.html", "re.extract is broken.")}; bundle { //re.grep local (cp); local (theList = {"aa", "aab", "a", "ab", ""}); local (s = "aa\raab\ra\rab\r\r"); cp = re.compile ("^aa"); assertEqual (re.grep (cp, theList), {"aa", "aab"}, "re.grep is broken."); assertEqual (re.grep (cp, s), {"aa", "aab"}, "re.grep is broken."); assertEqual (re.grep (cp, theList, flIncludeMatches:false), {"a", "ab", ""}, "re.grep is broken."); assertEqual (re.grep (cp, theList, flIncludeMatches:false), {"a", "ab", ""}, "re.grep is broken.")}; bundle { //re.join local (listA = {"a", "b", "c"}, listB = {"abcd", "", "efgh", ""}); assertEqual (re.join ("|", listA), "a|b|c", "re.join is broken."); assertEqual (re.join ("", listA), "abc", "re.join is broken."); assertEqual (re.join ("+/+", listB), "abcd+/++/+efgh+/+", "re.join is broken.")}; bundle { //re.split local (cp); local (s = "<title>test</title>\r<body>\rtest body\r</body>"); cp = re.compile ("<[^>]*>"); assertEqual (re.split (cp, s), {"", "test", "\r", "\rtest body\r", ""}, "re.split is broken."); assertEqual (re.split (cp, s, maxSplits:4), {"", "test", "\r", "\rtest body\r</body>"}, "re.split is broken."); cp = re.compile ("(<[^>]*>)"); assertEqual (re.split (cp, s), {"", "<title>", "test", "</title>", "\r", "<body>", "\rtest body\r", "</body>", ""}, "re.split is broken."); assertEqual (re.split (cp, s, maxSplits:3), {"", "<title>", "test", "</title>", "\r<body>\rtest body\r</body>"}, "re.split is broken."); local (s2 = "aBcDeFg"); cp = re.compile ("[a-z]+", flCaseSensitive:true); assertEqual (re.split (cp, s2), {"", "B", "D", "F", ""}, "re.split is broken."); cp = re.compile ("[^a-z]+", flCaseSensitive:true); assertEqual (re.split (cp, s2), {"a", "c", "e", "g"}, "re.split is broken."); cp = re.compile ("[A-Z]+", flCaseSensitive:true); assertEqual (re.split (cp, s2), {"a", "c", "e", "g"}, "re.split is broken."); cp = re.compile ("[^A-Z]+", flCaseSensitive:true); assertEqual (re.split (cp, s2), {"", "B", "D", "F", ""}, "re.split is broken.")}; bundle { //re.replace local (cp, ct); local (s = "To be or not to be", s2); cp = re.compile ("(be)"); s = re.replace (cp, "\\1BOP", s); assertEqual (s, "To beBOP or not to beBOP", "re.replace is broken."); cp = re.compile ("(be)(bop)", flCaseSensitive:false); s = re.replace (cp, "\\2\\1", s); assertEqual (s, "To BOPbe or not to BOPbe", "re.replace is broken."); cp = re.compile ("(BOP)(be)"); s = re.replace (cp, "\\2\\1", s, maxReplacements:1); assertEqual (s, "To beBOP or not to BOPbe", "re.replace is broken."); cp = re.compile ("(BOP)(be)"); s = re.replace (cp, "\\2\\1", s, adrReplacementCount:@ct); assertEqual (s, "To beBOP or not to beBOP", "re.replace is broken."); assertEqual (ct, 1, "re.replace is broken."); local (test = "Check http://www.muppets.com/~gonzo/ for more info, send your q's to mailto:go...@mu...."); local (result = "Check <A HREF=\"http://www.muppets.com/~gonzo/\">http://www.muppets.com/~gonzo/</A> for more info, send your q's to <A HREF=\"mailto:go...@mu...\">mailto:go...@mu...</A>."); cp = re.compile ("(http|mailto)(:[/]*[A-Za-z0-9]+[-_~%@:/\\.A-Za-z0-9]+[A-Za-z/0-9])"); test = re.replace (cp, "<A HREF=\"\\1\\2\">\\0</A>", test); assertEqual (test, result, "re.replace is broken.")}; bundle { //re.visit local (hits = 0); local (test = " <A href ='index.html' > <A href= 'index2.html' > "); on testCallback (adrTable) { case ++hits { 1 { assertEqual (adrTable^.matchOffset, 2, "re.visit is broken."); assertEqual (adrTable^.matchLength, 25, "re.visit is broken."); assertEqual (adrTable^.matchString, "<A href ='index.html' >", "re.visit is broken.")}; 2 { assertEqual (adrTable^.matchOffset, 28, "re.visit is broken."); assertEqual (adrTable^.matchLength, 33, "re.visit is broken."); assertEqual (adrTable^.matchString, "<A href= 'index2.html' >", "re.visit is broken.")}} else { abort ("re.visit is broken.")}; return (true)}; local (cp = re.compile ("<([^>]+)>")); re.visit (cp, test, @testCallback); assertEqual (hits, 2, "re.visit is broken.")}; bundle { //re.expand local (pat, mi); pat = re.compile ("(?P<date>(?P<year>(\\d\\d)?\\d\\d)-(?P<month>\\d\\d)-(?P<day>\\d\\d))", flAutoCapture:false); assert (re.match (pat, "2003-05-30", adrMatchInfoTable:@mi, flMakeGroups:true, flMakeNamedGroups:true), "re.match is broken"); assertEqual (re.expand ("\\g<date>", @mi), "2003-05-30", "re.expand is broken."); assertEqual (re.expand ("\\g<day>.\\g<month>.\\g<year>", @mi), "30.05.2003", "re.expand is broken."); assertEqual (re.expand ("\\g<4>.\\g<3>.\\g<2>", @mi), "30.05.2003", "re.expand is broken."); assertEqual (re.expand ("\\4.\\3.\\2", @mi), "30.05.2003", "re.expand is broken."); temp.mi = mi}; bundle { //group references local (cp, s = "To beBOP or not to beBOP", mi); cp = re.compile ("(?P<a>be)(?P<b>bop)", flCaseSensitive:false); assert (re.match (cp, s, adrMatchInfoTable:@mi, flMakeGroups:true, flMakeNamedGroups:true), "named groups are broken in re.match"); assertEqual (mi.namedGroups.a.groupNumber, 1, "named groups are broken in re.match"); assertEqual (mi.namedGroups.a.matchString, "be", "named groups are broken in re.match"); assertEqual (mi.namedGroups.a.matchOffset, 4, "named groups are broken in re.match"); assertEqual (mi.namedGroups.a.matchLength, 2, "named groups are broken in re.match"); assertEqual (mi.namedGroups.b.groupNumber, 2, "named groups are broken in re.match"); assertEqual (mi.namedGroups.b.matchString, "BOP", "named groups are broken in re.match"); assertEqual (mi.namedGroups.b.matchOffset, 6, "named groups are broken in re.match"); assertEqual (mi.namedGroups.b.matchLength, 3, "named groups are broken in re.match"); assertEqual (re.replace (cp, "\\g<b>\\g<a>", s), "To BOPbe or not to BOPbe", "named groups are broken in re.replace"); cp = re.compile ("(?P<x>be)(?P<xy>bop)", flCaseSensitive:false); assertEqual (re.replace (cp, "\\g<xy>\\g<x>", s), "To BOPbe or not to BOPbe", "named groups are broken in re.replace"); cp = re.compile ("(?P<x>be)(?P<xx>bop)", flCaseSensitive:false); assertEqual (re.replace (cp, "\\g<xx>\\g<x>", s), "To BOPbe or not to BOPbe", "named groups are broken in re.replace"); cp = re.compile ("(?P<x>be)(?P<xz>bop)", flCaseSensitive:false); assertEqual (re.replace (cp, "\\g<xz>\\g<x>", s), "To BOPbe or not to BOPbe", "named groups are broken in re.replace")}}; bundle { //debug code fUnit.runners.run (parentOf(this^), testCaseToRun: this)} --- NEW FILE: testTryElse --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testNesting --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testNesting on testNesting () { local (username = user.prefs.name); on xxx (name) { return (string.lower (name))}; if (xxx (username) != string.lower (username)) { scriptError ("Local handlers feature is broken.")}; bundle { on xxx (name) { return (string.upper (username))}; if (xxx (username) != string.upper (username)) { scriptError ("Local handlers feature is broken.")}}} --- NEW FILE: testOp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testObjects --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testSys --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testLocalDatabaseAccess --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testLists --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testExternalDatabaseAccess --- 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)} --- NEW FILE: testLoops --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testCase --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testCase on testCase () { local (i, ct); ct = 0; for i = 1 to 8 { case i { 1 { ct = ct + 1}; 2 { ct = ct + 10}; 3; 7 { ct = ct + 100}; 4; 8 { ct = ct + 1000}; 5 { ct = ct + 10000}} else { ct = ct + 100000}}; assertEqual(ct, 112211)} --- NEW FILE: testThreads --- (This appears to be a binary file; contents omitted.) --- NEW FILE: name --- FrontierVcsFile:1:TEXT:suites.fUnit.testSuperStress.name SuperStress --- NEW FILE: description --- FrontierVcsFile:1:wptx:suites.fUnit.testSuperStress.description These test scripts are derived from the SuperStress test suites as referenced at http://kernel.scripting.com/discuss/msgReader$43?mode=day . Because I am a Windows developer, I was not able to convert and test the Apple aspects of the stress test suite. If you are a mac developer, please help me out by doing so and removing this message. As I convert them I am deleting them, so anything left in fUnit.testing is yet to be converted. The following changes to SuperStress, beyond the use of assert*, have been made: * testClock does not copy the code that checked root's children and asserted their creating and modification time were between 1990 and 2000. It is replaced by code that creates an object in the scratchpad, checks that the creation time is within a second of now, waits a second, modifies the value, and checks that the modification time has changed. (It keeps the check on Frontier.isRuntime because I don't know what that is.) * testMacOSXFileHandling has been converted, but since I can't run it the original has been left behind in case I made an error. I may have screwed up the initial test for OS, too. A couple of tests that look like they should run have been uncommented. "time consuming stuff every 4 calls or so" has been promoted to every call for obvious reasons. There is a test that looks broken in "bundle // test 5.0.1 verbs", checking for osMacOS to see if the line feed is \n; seems incomplete. * testLists has a Mac-specific chunk, though I don't see what is Mac specific about it and it passes on my Frontier so I've added an "|| 1" to the if clause. If no one tells me otherwise a later release will remove the if so the code always runs. * testMisc has a mac-only portion I didn't translate. --- NEW FILE: testTypeOf --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testTypeOf on testTypeOf () { on testIt (val, type) { assertEqual(typeOf(val), type, "typeOf (" + string (val) + ") should have been '" + type + "', but was '" + typeOf (val) + "\'.")}; testIt ('A', charType); testIt ('XXXX', string4Type); testIt (true, booleanType); testIt (number (1), longType); testIt ("123456789", stringType); testIt (clock.now (), dateType); testIt (up, directionType); testIt (@system.misc, addressType); testIt (point.set (12, 24), pointType); testIt (rectangle.set (12, 24, 36, 48), rectType); testIt (single (1), singleType); testIt (double (2), doubleType); if (sys.os() == osMacOS) { testIt (objectModel.high, enumeratorType); testIt (fixed (3), fixedType)}; testIt ({}, listType); testIt (record ({}), recordType); assertEqual(typeOf(system), tableType, "typeOf is broken")} --- NEW FILE: testGarbageCollection --- FrontierVcsFile:1:scpt:suites.fUnit.testSuperStress.testGarbageCollection on testGarbageCollection () { // a loop that really stresses garbage collection local (i, s, t); for i = 1 to 10 { s = "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a" + "a"; t = "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z" + "z"; assertEqual(sizeof(s), sizeof(t), "Something is wrong with the tmpstack.")}} |