-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path008_number.xml
More file actions
119 lines (87 loc) · 2.45 KB
/
008_number.xml
File metadata and controls
119 lines (87 loc) · 2.45 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
<?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="008" name="number">
<test-case id="001" name="insensitive">
<script>
var t = debug.assert;
t( 1 == 1 );
t( 1 == 1.0 );
t( 1 != 1.1 );
t( 1 == "1" );
t( "1" == 1 );
</script>
</test-case>
<test-case id="002" name="toString">
<script>
var t = debug.assert;
t( Number(54892).toString() === '54892' );
t( Number(54892).toString(16) === 'd66c' );
t( Number(98).toString(2) === '1100010' );
</script>
</test-case>
<test-case id="003" name="times">
<script>
var t = debug.assert;
Number.prototype.times = function (iterator) {
for (var i=0; i < this; i++) {
iterator.call(i);
}
};
var a = 0;
Number(10).times(() => {
a += this;
});
t(a, 45);
</script>
</test-case>
<test-case id="010" name="instance">
<script>
var t = debug.assert;
var a = new Number(10);
var b = 20;
t( a, 10 );
t( b, 20 );
t( typeof a, 'object' );
t( typeof b, 'number' );
t( a instanceof Number );
t( b instanceof Number );
t( typeof (a + b), 'number' );
t( (a + b) instanceof Number );
</script>
</test-case>
<test-case id="011" name="instance compare">
<script>
var t = debug.assert;
var a = new Number(10);
t( a == 10 );
t( a > 5 );
t( a < 15 );
t( a >= 10 );
t( a <= 10 );
</script>
</test-case>
<test-case id="021" name="binary">
<script>
var t = debug.assert;
var a = 4;
var b = new Number(a);
t( b.toString(2), '100' );
</script>
</test-case>
</test-suite>