-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path011_math.xml
More file actions
83 lines (63 loc) · 1.87 KB
/
011_math.xml
File metadata and controls
83 lines (63 loc) · 1.87 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
<?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="011" name="math">
<test-case id="001">
<script>
var t = debug.assert;
t( Math != null );
</script>
</test-case>
<test-case id="002">
<script>
var t = debug.assert;
t( Math.min(10, 20), 10 );
t( Math.max(5.22, 10.2233), 10.2233 );
t( Math.PI, 3.141592653589793 );
t( Math.E, 2.71828182845904 );
t( Math.LN2, 0.6931471805599453 );
t( Math.LN10, 2.302585092994046 );
</script>
</test-case>
<test-case id="003">
<script>
var t = debug.assert;
t( Math.floor(3.22) == 3 );
t( Math.floor(3.65) == 3 );
t( Math.round(3.22) == 3 );
t( Math.round(3.65) == 4 );
t( Math.random() > 0 );
t( Math.random() < 1 );
</script>
</test-case>
<test-case id="004" name="min, max">
<script>
var t = debug.assert;
t( Math.min(1, 2), 1 );
t( Math.min(1, 2, 3), 1 );
t( Math.min(-10, -20, 0), -20 );
var arr = [10, 20, "30"];
t( Math.min.apply(null, arr), 10 );
t( Math.max(10, 20), 20 );
t( Math.max(10, 20, 30), 30 );
t( Math.max(-10, -20, 0), 0 );
var arr = [-300, "-200", 0, 100, 200, 300];
t( Math.max.apply(null, arr), 300 );
</script>
</test-case>
</test-suite>