-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path001_core.xml
More file actions
105 lines (80 loc) · 2.52 KB
/
001_core.xml
File metadata and controls
105 lines (80 loc) · 2.52 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
<?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="001" name="debug">
<test-case id="001">
<script>
// check whether debugger currently is supported
if (debug == null) {
alert('No debugger supported. Try start by test-case runner.');
return;
}
// dummy call debug.assert, should not crash
debug.assert(true);
// debug.assert usage:
//
// assert( boolean_expression ) // false to raise assert runtime exception
//
// assert( result, expect ) // compare 'result' and 'expect', difference result to
// // raise assert runtime exception
</script>
</test-case>
<test-case id="002" name="number toString">
<script>
var t = debug.assert;
var a = 4;
var b = new Number(a);
// toString to binary
t( b.toString(2) == '100' );
</script>
</test-case>
<test-case id="003" name="isNaN">
<script>
var t = debug.assert;
t( isNaN(123) , false );
t( isNaN(-1.23) , false );
t( isNaN(5-2) , false );
t( isNaN(0) , false );
t( isNaN('123') , false );
t( isNaN('Hello') , true );
t( isNaN('2005/12/12') , true );
t( isNaN([1, 2, 3]) , true );
// ReoScript interprets empty string as non-number
//t( isNaN('') , false );
// ReoScript interpetes bool value as non-number
//t( isNaN(true) , false );
t( isNaN(undefined) , true );
// these will fail
//t( isNaN('NaN') , true );
//t( isNaN(NaN) , true );
t( isNaN(0 / 0) , true );
</script>
</test-case>
<test-case id="004" name="boolean comparison">
<script>
var t = debug.assert;
t( 10 == 10 );
t( 010 == 10 );
t( 0b10100 == 20 );
t( 0x1e == 30 );
t( "2" == 2 );
t( 3 == "3" );
t( "-1" == "-1" );
</script>
</test-case>
</test-suite>