-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calc.test.wsf
96 lines (75 loc) · 3.1 KB
/
Calc.test.wsf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<job>
<script language="vbscript" src="class/VbsUnitTest.vbs"></script>
<script language="vbscript" src="calc.vbs"></script>
<script language="vbscript">
Dim Expected, Actual
Set Test = new VbsUnitTest
Test.BeginTest WScript.ScriptName
Test.BeginTestsuite "Sum"
Test.BeginTestcase "Sum(1, 2) returns 3"
Expected = 3
Actual = Sum(1, 2)
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "Sum(""1"", ""2"") returns 3"
Expected = 3
Actual = Sum("1", "2")
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "Sum(null, 2) returns 2"
Expected = 2
Actual = Sum(null, 2)
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "Sum(""abc"", 2) returns 2"
Expected = 2
Actual = Sum("abc", 2)
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.EndTestsuite
Test.BeginTestsuite "Diff"
Test.BeginTestcase "Diff(1, 2) returns -1"
Expected = -1
Actual = Diff(1, 2)
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "Diff(""1"", ""2"") returns -1"
Expected = -1
Actual = Diff("1", "2")
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "Diff(null, 2) returns -2"
Expected = -2
Actual = Diff(null, 2)
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "Diff(""abc"", 2) returns -2"
Expected = -2
Actual = Diff("abc", 2)
Test.AssertEquals Expected, Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.EndTestsuite
Test.BeginTestsuite "IsOdd"
Test.BeginTestcase "IsOdd(1) returns True"
Actual = IsOdd(1)
Test.AssertTrue Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "IsOdd(2) returns False"
Actual = IsOdd(2)
Test.AssertFalse Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.EndTestsuite
Test.BeginTestsuite "IsEven"
Test.BeginTestcase "IsEven(1) returns False"
Actual = IsEven(1)
Test.AssertFalse Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.BeginTestcase "IsEven(2) returns True"
Actual = IsEven(2)
Test.AssertTrue Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
Test.EndTestsuite
Test.EndTest
WScript.Echo Test.Xml()
</script>
</job>