-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calc.test.asp
130 lines (107 loc) · 3.68 KB
/
Calc.test.asp
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<script language="vbscript" runat="server" src="Class/VbsUnitTest.vbs"></script>
<script language="vbscript" runat="server" src="Calc.vbs"></script>
<%
Response.AddHeader "Content-Type", "application/xml; charset=utf-8"
Dim Expected, Actual
Set Test = new VbsUnitTest
'Begin Test
Test.BeginTest Request.ServerVariables("SCRIPT_NAME")
'Begin Testsuite
Test.BeginTestsuite "Sum"
'Begin Testcase
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
'End Testcase
'Begin Testcase
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
'End Testcase
'Begin Testcase
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
'End Testcase
'Begin Testcase
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
'End Testsuite
'Begin Testsuite
Test.BeginTestsuite "Diff"
'Begin Testcase
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
'End Testcase
'Begin Testcase
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
'End Testcase
'Begin Testcase
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
'End Testcase
'Begin Testcase
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
'End Testcase
Test.EndTestsuite
'End Testsuite
'Begin Testsuite
Test.BeginTestsuite "IsOdd"
'Begin Testcase
Test.BeginTestcase "IsOdd(1) returns True"
Actual = IsOdd(1)
Test.AssertTrue Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
'End Testcase
'Begin Testcase
Test.BeginTestcase "IsOdd(2) returns False"
Actual = IsOdd(2)
Test.AssertFalse Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
'End Testcase
Test.EndTestsuite
'End Testsuite
'Begin Testsuite
Test.BeginTestsuite "IsEven"
'Begin Testcase
Test.BeginTestcase "IsEven(1) returns False"
Actual = IsEven(1)
Test.AssertFalse Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
'End Testcase
'Begin Testcase
Test.BeginTestcase "IsEven(2) returns True"
Actual = IsEven(2)
Test.AssertTrue Actual, "Expected is '" & Expected & "'.but Actual is '" & Actual & "'"
Test.EndTestcase
'End Testcase
Test.EndTestsuite
'End Testsuite
Test.EndTest
'End Test
Response.Write(Test.Xml())
%>