-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path003_var.xml
More file actions
138 lines (105 loc) · 2.83 KB
/
003_var.xml
File metadata and controls
138 lines (105 loc) · 2.83 KB
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
131
132
133
134
135
136
137
138
<?xml version="1.0" encoding="utf-8" ?>
<!--
/*****************************************************************************
*
* ReoScript - .NET Script Language Engine
*
* https://github.com/unvell/ReoScript
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
* PURPOSE.
*
* This software released under MIT license.
* Copyright (c) 2012-2019 Jingwood, unvell.com, all rights reserved.
*
****************************************************************************/
-->
<test-suite id="003" name="var">
<test-case id="001">
<script>
var t = debug.assert;
var a = 10, b = 20;
t(a == 10);
t(b == 20);
</script>
</test-case>
<test-case id="002">
<script>
var t = debug.assert;
var a = 10;
t( a == 10 );
var b = a + 10;
t( b == 20 );
t( a == b - 10 );
var c = a * b;
t( c == 200 );
t( b == 200 / a );
var d = a / b;
t( d == 0.5 );
t( a == b * 0.5 );
t( a == 10 );
t( b == 20 );
t( c == 200 );
t( d == 0.5 );
</script>
</test-case>
<test-case id="003">
<script>
var t = debug.assert;
var a = 10, b = 20;
var c = b / a, d = a * b;
var e = ( c == d / 100 );
t(e == true);
</script>
</test-case>
<test-case id="004" name="bool">
<script>
var t = debug.assert;
var a = true, b = false;
t(a == !b);
t(a != b);
t(!(a < b));
t(!(a > b));
</script>
</test-case>
<test-case id="005" name="global">
<script>
var t = debug.assert;
t( undefined == null );
var a = 10; // local variable in global scope
// is global variable
t( a != null );
a = null; // clear variable
t( a == null && a == undefined );
</script>
</test-case>
<test-case id="006" name="increment">
<script>
var t = debug.assert;
var o1 = {a: 0};
t( o1.a++ == 0 );
t( o1.a == 1 );
var arr = [0,1,2,3];
t( arr[1]++ == 1 );
t( arr[1] == 2 );
</script>
</test-case>
<test-case id="010" name="scope">
<script>
var t = debug.assert;
var a = 10;
t( this.a == 10 ); // global variable
function () {
a = 20; // access global variable in function
} ();
t( a == 20 );
function () {
var a = 30; // access local variable in function
// should not modify global variable
} ();
t( a == 20 );
</script>
</test-case>
</test-suite>