VBScript Built-in Functions Test / VBScript 内置函数测试

Tests all 93 VBScript built-in functions from the Script 5.6 CHM knowledge base.
测试 Script 5.6 CHM 知识库中全部 93 个 VBScript 内置函数。
Each function is called with sample arguments. If the call succeeds and returns a plausible result, it PASSes.
每个函数用示例参数调用,调用成功且返回合理结果即 PASS。

1. Math Functions / 数学函数 (12)

Function / 函数Call / 调用Result / 结果Result / 结果
AbsAbs(-5.7)5.7PASS / 通过
AtnAtn(1)0.7853981633974483PASS / 通过
CosCos(0)1PASS / 通过
ExpExp(1)2.718281828459045PASS / 通过
IntInt(-5.7)-6PASS / 通过
FixFix(-5.7)-5PASS / 通过
LogLog(1)0PASS / 通过
RndRnd()random [0,1)PASS / 通过
SgnSgn(-5)-1PASS / 通过
SinSin(0)0PASS / 通过
SqrSqr(16)4PASS / 通过
TanTan(0)0PASS / 通过

2. Conversion Functions / 类型转换函数 (15)

Function / 函数Call / 调用Result / 结果Result / 结果
CBoolCBool(1)TruePASS / 通过
CByteCByte(42)42PASS / 通过
CCurCCur(123.45)123.45PASS / 通过
CDateCDate("2024-01-15")15/01/2024PASS / 通过
CDblCDbl("3.14")3.14PASS / 通过
CIntCInt(3.7)4PASS / 通过
CLngCLng(3.7)4PASS / 通过
CSngCSng("3.14")3.140000104904175PASS / 通过
CStrCStr(42)42PASS / 通过
ChrChr(65)APASS / 通过
AscAsc("A")65PASS / 通过
HexHex(255)FFPASS / 通过
OctOct(8)10PASS / 通过

3. String Functions / 字符串函数 (19)

Function / 函数Call / 调用Result / 结果Result / 结果
InStrInStr("Hello World","World")7PASS / 通过
InStrRevInStrRev("Hello World","o")8PASS / 通过
LCaseLCase("HELLO")helloPASS / 通过
UCaseUCase("hello")HELLOPASS / 通过
LeftLeft("Hello",3)HelPASS / 通过
RightRight("Hello",3)lloPASS / 通过
MidMid("Hello World",7,5)WorldPASS / 通过
LTrimLTrim(" hi ")hi PASS / 通过
RTrimRTrim(" hi ") hiPASS / 通过
TrimTrim(" hi ")hiPASS / 通过
LenLen("Hello")5PASS / 通过
SpaceLen(Space(5))5PASS / 通过
StringString(3,"*")***PASS / 通过
StrCompStrComp("abc","ABC",1)0PASS / 通过
StrReverseStrReverse("ABC")CBAPASS / 通过
ReplaceReplace("aabaa","a","x")xxbxxPASS / 通过
JoinJoin(Array("a","b","c"),",")a,b,cPASS / 通过
SplitUBound(Split("a,b,c",","))2PASS / 通过
FilterUBound(Filter(Array("ab","cd","ae"),"a"))1PASS / 通过

4. Date/Time Functions / 日期时间函数 (20)

Function / 函数Call / 调用Result / 结果Result / 结果
DateDate()28/10/2026PASS / 通过
TimeTime()03:30:55PASS / 通过
NowNow()28/10/2026 03:30:55PASS / 通过
DayDay(#2024-01-15#)14FAIL / 失败
HourHour(#13:45:30#)10FAIL / 失败
MinuteMinute(#13:45:30#)39FAIL / 失败
MonthMonth(#2024-06-15#)6PASS / 通过
MonthNameMonthName(6)junhoPASS / 通过
SecondSecond(#13:45:30#)2FAIL / 失败
WeekdayWeekday(#2024-01-15#)1PASS / 通过
WeekdayNameWeekdayName(1)domingoPASS / 通过
YearYear(#2024-06-15#)2024PASS / 通过
DateAddDateAdd("d",1,#2024-01-15#)15/01/2024 21:00:00PASS / 通过
DateDiffDateDiff("d",#2024-01-01#,#2024-01-31#)30PASS / 通过
DatePartDatePart("yyyy",#2024-06-15#)2024PASS / 通过
DateSerialDateSerial(2024,1,15)15/01/2024PASS / 通过
DateValueDateValue("2024-01-15")15/01/2024PASS / 通过
TimeSerialTimeSerial(13,45,30)13:45:30PASS / 通过
TimeValueTimeValue("13:45:30")13:45:30PASS / 通过
TimerTimer()12655.116585996PASS / 通过

5. Array Functions / 数组函数 (3)

Function / 函数Call / 调用Result / 结果Result / 结果
ArrayArray(10,20,30)(1)20PASS / 通过
LBoundLBound(testArr)0PASS / 通过
UBoundUBound(testArr)2PASS / 通过

6. Format Functions / 格式化函数 (4)

Function / 函数Call / 调用Result / 结果Result / 结果
FormatCurrencyFormatCurrency(1234.5)R$ 1.234,50PASS / 通过
FormatDateTimeFormatDateTime(#2024-01-15#,1)domingo, 14 de janeiro de 2024PASS / 通过
FormatNumberFormatNumber(1234.567,2)1.234,57PASS / 通过
FormatPercentFormatPercent(0.75,1)75,0%PASS / 通过

7. Type-Check Functions / 类型判断函数 (8)

Function / 函数Call / 调用Result / 结果Result / 结果
IsArrayIsArray(Array(1,2))TruePASS / 通过
IsDateIsDate("2024-01-15")TruePASS / 通过
IsEmptyIsEmpty(unInit)TruePASS / 通过
IsNullIsNull(Null)TruePASS / 通过
IsNumericIsNumeric("42")TruePASS / 通过
IsObjectIsObject(Response)TruePASS / 通过
TypeNameTypeName(42)IntegerPASS / 通过
VarTypeVarType("hello")8PASS / 通过

8. Object/Automation Functions / 对象函数 (3)

Function / 函数Call / 调用Result / 结果Result / 结果
CreateObjectCreateObject("Scripting.FileSystemObject")ObjectPASS / 通过
GetObjectGetObject("","Scripting.FileSystemObject")ObjectPASS / 通过
GetRefGetRef("TestRefFunc")()42PASS / 通过

9. Execution Functions / 执行函数 (3)

Function / 函数Call / 调用Result / 结果Result / 结果
EvalEval("2 + 3")5PASS / 通过
ExecuteExecute("Dim execTestVar = 99")executedPASS / 通过
ExecuteGlobalExecuteGlobal("Dim execGVar = 100")executedPASS / 通过

10. Input/Output Functions / 输入输出函数 (3)

Function / 函数Call / 调用Result / 结果Result / 结果
InputBoxInputBox("prompt")N/A — requires UI, skipped on serverSKIP / 跳过
MsgBoxMsgBox("test", vbOKOnly)N/A — requires UI, skipped on serverSKIP / 跳过
LoadPictureLoadPicture("")object returnedPASS / 通过

11. Script Engine Functions / 引擎信息函数 (4)

Function / 函数Call / 调用Result / 结果Result / 结果
ScriptEngineScriptEngine()VBScriptPASS / 通过
ScriptEngineMajorVersionScriptEngineMajorVersion()5PASS / 通过
ScriptEngineMinorVersionScriptEngineMinorVersion()8PASS / 通过
ScriptEngineBuildVersionScriptEngineBuildVersion()16384PASS / 通过

12. Locale Functions / 区域设置函数 (2)

Function / 函数Call / 调用Result / 结果Result / 结果
GetLocaleGetLocale()1046PASS / 通过
SetLocaleSetLocale("1046")set back to originalPASS / 通过

13. Color Function / 颜色函数 (1)

Function / 函数Call / 调用Result / 结果Result / 结果
RGBRGB(255,0,0)255PASS / 通过

Summary / 测试汇总

Total Tests / 总测试数: 95

Passed / 通过: 91

Failed / 失败: 4

Skipped / 跳过: 2 (InputBox, MsgBox — require UI)

4 function(s) failed: Day | Hour | Minute | Second |

Source / 来源: Script 5.6 CHM — vtorifunctions.htm + 91 vsfct*.htm files (en/ + cn/)
Total: 12 + 15 + 19 + 20 + 3 + 4 + 8 + 3 + 3 + 3 + 4 + 2 + 1 = 93 built-in functions