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 / 结果 |
| Abs | Abs(-5.7) | 5.7 | PASS / 通过 |
| Atn | Atn(1) | 0.7853981633974483 | PASS / 通过 |
| Cos | Cos(0) | 1 | PASS / 通过 |
| Exp | Exp(1) | 2.718281828459045 | PASS / 通过 |
| Int | Int(-5.7) | -6 | PASS / 通过 |
| Fix | Fix(-5.7) | -5 | PASS / 通过 |
| Log | Log(1) | 0 | PASS / 通过 |
| Rnd | Rnd() | random [0,1) | PASS / 通过 |
| Sgn | Sgn(-5) | -1 | PASS / 通过 |
| Sin | Sin(0) | 0 | PASS / 通过 |
| Sqr | Sqr(16) | 4 | PASS / 通过 |
| Tan | Tan(0) | 0 | PASS / 通过 |
2. Conversion Functions / 类型转换函数 (15)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| CBool | CBool(1) | True | PASS / 通过 |
| CByte | CByte(42) | 42 | PASS / 通过 |
| CCur | CCur(123.45) | 123.45 | PASS / 通过 |
| CDate | CDate("2024-01-15") | 15/01/2024 | PASS / 通过 |
| CDbl | CDbl("3.14") | 3.14 | PASS / 通过 |
| CInt | CInt(3.7) | 4 | PASS / 通过 |
| CLng | CLng(3.7) | 4 | PASS / 通过 |
| CSng | CSng("3.14") | 3.140000104904175 | PASS / 通过 |
| CStr | CStr(42) | 42 | PASS / 通过 |
| Chr | Chr(65) | A | PASS / 通过 |
| Asc | Asc("A") | 65 | PASS / 通过 |
| Hex | Hex(255) | FF | PASS / 通过 |
| Oct | Oct(8) | 10 | PASS / 通过 |
3. String Functions / 字符串函数 (19)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| InStr | InStr("Hello World","World") | 7 | PASS / 通过 |
| InStrRev | InStrRev("Hello World","o") | 8 | PASS / 通过 |
| LCase | LCase("HELLO") | hello | PASS / 通过 |
| UCase | UCase("hello") | HELLO | PASS / 通过 |
| Left | Left("Hello",3) | Hel | PASS / 通过 |
| Right | Right("Hello",3) | llo | PASS / 通过 |
| Mid | Mid("Hello World",7,5) | World | PASS / 通过 |
| LTrim | LTrim(" hi ") | hi | PASS / 通过 |
| RTrim | RTrim(" hi ") | hi | PASS / 通过 |
| Trim | Trim(" hi ") | hi | PASS / 通过 |
| Len | Len("Hello") | 5 | PASS / 通过 |
| Space | Len(Space(5)) | 5 | PASS / 通过 |
| String | String(3,"*") | *** | PASS / 通过 |
| StrComp | StrComp("abc","ABC",1) | 0 | PASS / 通过 |
| StrReverse | StrReverse("ABC") | CBA | PASS / 通过 |
| Replace | Replace("aabaa","a","x") | xxbxx | PASS / 通过 |
| Join | Join(Array("a","b","c"),",") | a,b,c | PASS / 通过 |
| Split | UBound(Split("a,b,c",",")) | 2 | PASS / 通过 |
| Filter | UBound(Filter(Array("ab","cd","ae"),"a")) | 1 | PASS / 通过 |
4. Date/Time Functions / 日期时间函数 (20)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| Date | Date() | 28/10/2026 | PASS / 通过 |
| Time | Time() | 03:30:55 | PASS / 通过 |
| Now | Now() | 28/10/2026 03:30:55 | PASS / 通过 |
| Day | Day(#2024-01-15#) | 14 | FAIL / 失败 |
| Hour | Hour(#13:45:30#) | 10 | FAIL / 失败 |
| Minute | Minute(#13:45:30#) | 39 | FAIL / 失败 |
| Month | Month(#2024-06-15#) | 6 | PASS / 通过 |
| MonthName | MonthName(6) | junho | PASS / 通过 |
| Second | Second(#13:45:30#) | 2 | FAIL / 失败 |
| Weekday | Weekday(#2024-01-15#) | 1 | PASS / 通过 |
| WeekdayName | WeekdayName(1) | domingo | PASS / 通过 |
| Year | Year(#2024-06-15#) | 2024 | PASS / 通过 |
| DateAdd | DateAdd("d",1,#2024-01-15#) | 15/01/2024 21:00:00 | PASS / 通过 |
| DateDiff | DateDiff("d",#2024-01-01#,#2024-01-31#) | 30 | PASS / 通过 |
| DatePart | DatePart("yyyy",#2024-06-15#) | 2024 | PASS / 通过 |
| DateSerial | DateSerial(2024,1,15) | 15/01/2024 | PASS / 通过 |
| DateValue | DateValue("2024-01-15") | 15/01/2024 | PASS / 通过 |
| TimeSerial | TimeSerial(13,45,30) | 13:45:30 | PASS / 通过 |
| TimeValue | TimeValue("13:45:30") | 13:45:30 | PASS / 通过 |
| Timer | Timer() | 12655.116585996 | PASS / 通过 |
5. Array Functions / 数组函数 (3)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| Array | Array(10,20,30)(1) | 20 | PASS / 通过 |
| LBound | LBound(testArr) | 0 | PASS / 通过 |
| UBound | UBound(testArr) | 2 | PASS / 通过 |
6. Format Functions / 格式化函数 (4)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| FormatCurrency | FormatCurrency(1234.5) | R$ 1.234,50 | PASS / 通过 |
| FormatDateTime | FormatDateTime(#2024-01-15#,1) | domingo, 14 de janeiro de 2024 | PASS / 通过 |
| FormatNumber | FormatNumber(1234.567,2) | 1.234,57 | PASS / 通过 |
| FormatPercent | FormatPercent(0.75,1) | 75,0% | PASS / 通过 |
7. Type-Check Functions / 类型判断函数 (8)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| IsArray | IsArray(Array(1,2)) | True | PASS / 通过 |
| IsDate | IsDate("2024-01-15") | True | PASS / 通过 |
| IsEmpty | IsEmpty(unInit) | True | PASS / 通过 |
| IsNull | IsNull(Null) | True | PASS / 通过 |
| IsNumeric | IsNumeric("42") | True | PASS / 通过 |
| IsObject | IsObject(Response) | True | PASS / 通过 |
| TypeName | TypeName(42) | Integer | PASS / 通过 |
| VarType | VarType("hello") | 8 | PASS / 通过 |
8. Object/Automation Functions / 对象函数 (3)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| CreateObject | CreateObject("Scripting.FileSystemObject") | Object | PASS / 通过 |
| GetObject | GetObject("","Scripting.FileSystemObject") | Object | PASS / 通过 |
| GetRef | GetRef("TestRefFunc")() | 42 | PASS / 通过 |
9. Execution Functions / 执行函数 (3)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| Eval | Eval("2 + 3") | 5 | PASS / 通过 |
| Execute | Execute("Dim execTestVar = 99") | executed | PASS / 通过 |
| ExecuteGlobal | ExecuteGlobal("Dim execGVar = 100") | executed | PASS / 通过 |
10. Input/Output Functions / 输入输出函数 (3)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| InputBox | InputBox("prompt") | N/A — requires UI, skipped on server | SKIP / 跳过 |
| MsgBox | MsgBox("test", vbOKOnly) | N/A — requires UI, skipped on server | SKIP / 跳过 |
| LoadPicture | LoadPicture("") | object returned | PASS / 通过 |
11. Script Engine Functions / 引擎信息函数 (4)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| ScriptEngine | ScriptEngine() | VBScript | PASS / 通过 |
| ScriptEngineMajorVersion | ScriptEngineMajorVersion() | 5 | PASS / 通过 |
| ScriptEngineMinorVersion | ScriptEngineMinorVersion() | 8 | PASS / 通过 |
| ScriptEngineBuildVersion | ScriptEngineBuildVersion() | 16384 | PASS / 通过 |
12. Locale Functions / 区域设置函数 (2)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| GetLocale | GetLocale() | 1046 | PASS / 通过 |
| SetLocale | SetLocale("1046") | set back to original | PASS / 通过 |
13. Color Function / 颜色函数 (1)
| Function / 函数 | Call / 调用 | Result / 结果 | Result / 结果 |
| RGB | RGB(255,0,0) | 255 | PASS / 通过 |
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