//# ==++== //# //# //# Copyright (c) 2002 Microsoft Corporation. All rights reserved. //# //# The use and distribution terms for this software are contained in the file //# named license.txt, which can be found in the root of this distribution. //# By using this software in any fashion, you are agreeing to be bound by the //# terms of this license. //# //# You must not remove this notice, or any other, from this software. //# //# //# ==--== //#################################################################################### @cc_on import System; var NULL_DISPATCH = null; var apGlobalObj; var apPlatform; var lFailCount; var iTestID = 53682; function FuncRetVal() { return "655.35"; } function FuncRetNulVal() { return ""; } function myObject() { this.retVal = myObjVal(); } function myObjVal() { return 123321; } function strop04() { var tmp,res,expected,emptyVar; var myDate = new Date(); myDate.setTime(0); // this is Wed Dec 31 16:00:00 PST 1969 var numvar = 4321; var strvar = "57"; var strvarnul = ""; var boolvar = new Boolean(true); var ary = new Array(); ary[2] = 12.14; ary[3] = 13.14; ary[4] = 15.14; var myObj = new myObject(); var myStr = new String("112"); apInitTest("strop04"); apInitScenario("null string variable += expr"); res = strvarnul; res += "alpha" + "beta"; expected = "alphabeta"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += funcretval"); res = strvarnul; res += FuncRetVal(); expected = "655.35"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += literal"); res = strvarnul; res += "JavaScript"; expected = "JavaScript"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += variable"); res = strvarnul; res += strvar; expected = "57"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += null expr"); res = strvarnul; res += "" + ""; expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += null funcretval"); res = strvarnul; res += FuncRetNulVal(); expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += null literal"); res = strvarnul; res += ""; expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += null variable"); res = strvarnul; res += strvarnul; expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += boolean"); res = strvarnul; res += boolvar; expected = "true"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += numeric literal"); res = strvarnul; res += 55.2; expected = "55.2"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += numeric var"); res = strvarnul; res += numvar; expected = "4321"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable += object"); res = strvarnul; res += myObj; expected = "[object Object]"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } if( new Date("12/25/2002 12:00:00 PST").getTimezoneOffset()/60 == 8) { apInitScenario("null string variable += date"); res = strvarnul; res += myDate; expected = "Wed Dec 31 16:00:00 PST 1969"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } } apInitScenario("null string variable + expr"); res = strvarnul + "alpha" + "beta"; expected = "alphabeta"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + funcretval"); res = strvarnul + FuncRetVal(); expected = "655.35"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + literal"); res = strvarnul + "JavaScript"; expected = "JavaScript"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + variable"); res = strvarnul + strvar; expected = "57"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + null expr"); res = strvarnul + "" + ""; expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + null funcretval"); res = strvarnul + FuncRetNulVal(); expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + null literal"); res = strvarnul + ""; expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + null variable"); res = strvarnul + strvarnul; expected = ""; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + boolean"); res = strvarnul + boolvar; expected = "true"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + numeric literal"); res = strvarnul + 55.2; expected = "55.2"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + numeric var"); res = strvarnul + numvar; expected = "4321"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } apInitScenario("null string variable + object"); res = strvarnul + myObj; expected = "[object Object]"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } if( new Date("12/25/2002 12:00:00 PST").getTimezoneOffset()/60 == 8) { apInitScenario("null string variable + date"); res = strvarnul + myDate; expected = "Wed Dec 31 16:00:00 PST 1969"; if (res != expected) { apLogFailInfo("wrong result",expected,res,""); } if (typeof(res) != typeof(expected)) { apLogFailInfo("wrong result",typeof(expected),typeof(res),""); } } apEndTest(); } strop04(); if(lFailCount >= 0) System.Environment.ExitCode = lFailCount; else System.Environment.ExitCode = 1; function apInitTest(stTestName) { lFailCount = 0; apGlobalObj = new Object(); apGlobalObj.apGetPlatform = function Funca() { return "Rotor" } apGlobalObj.LangHost = function Funcb() { return 1033;} apGlobalObj.apGetLangExt = function Funcc(num) { return "EN"; } apPlatform = apGlobalObj.apGetPlatform(); var sVer = "1.0"; //navigator.appVersion.toUpperCase().charAt(navigator.appVersion.toUpperCase().indexOf("MSIE")+5); apGlobalObj.apGetHost = function Funcp() { return "Rotor " + sVer; } print ("apInitTest: " + stTestName); } function apInitScenario(stScenarioName) {print( "\tapInitScenario: " + stScenarioName);} function apLogFailInfo(stMessage, stExpected, stActual, stBugNum) { lFailCount = lFailCount + 1; print ("***** FAILED:"); print ("\t\t" + stMessage); print ("\t\tExpected: " + stExpected); print ("\t\tActual: " + stActual); } function apGetLocale(){ return 1033; } function apWriteDebug(s) { print("dbg ---> " + s) } function apEndTest() {}