tests: test equality on Float
[nit.git] / tests / base_eq_float.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import kernel
16
17 fun get_float(f: Float): Float do return f
18 fun get_object(f: Float): Object do return f
19
20 var fp: Float = get_float(0.0)
21 var fm: Float = get_float(-0.0)
22 var f1: Float = get_float(1.0)
23 var ofp: Object = get_float(0.0)
24 var ofm: Object = get_float(-0.0)
25 var of1: Object = get_float(1.0)
26 var op: Object = get_object(0.0)
27 var om: Object = get_object(-0.0)
28 var o1: Object = get_object(1.0)
29
30 fp.output
31 fm.output
32 f1.output
33 ofp.output
34 ofm.output
35 of1.output
36 op.output
37 om.output
38 o1.output
39
40 (fp is fp).output
41 (fp is fm).output
42 (not fp is f1).output
43 (fp is ofp).output
44 (fp is ofm).output
45 (not fp is of1).output
46 (fp is op).output
47 (fp is om).output
48 (not fp is o1).output
49 '\n'.output
50 (fm is fp).output
51 (fm is fm).output
52 (not fm is f1).output
53 (fm is ofp).output
54 (fm is ofm).output
55 (not fm is of1).output
56 (fm is op).output
57 (fm is om).output
58 (not fm is o1).output
59 '\n'.output
60 (ofp is fp).output
61 (ofp is fm).output
62 (not ofp is f1).output
63 (ofp is ofp).output
64 (ofp is ofm).output
65 (not ofp is of1).output
66 (ofp is op).output
67 (ofp is om).output
68 (not ofp is o1).output
69 '\n'.output
70 (ofm is fp).output
71 (ofm is fm).output
72 (not ofm is f1).output
73 (ofm is ofp).output
74 (ofm is ofm).output
75 (not ofm is of1).output
76 (ofm is op).output
77 (ofm is om).output
78 (not ofm is o1).output
79 '\n'.output
80 (op is fp).output
81 (op is fm).output
82 (not op is f1).output
83 (op is ofp).output
84 (op is ofm).output
85 (not op is of1).output
86 (op is op).output
87 (op is om).output
88 (not op is o1).output
89 '\n'.output
90 (om is fp).output
91 (om is fm).output
92 (not om is f1).output
93 (om is ofp).output
94 (om is ofm).output
95 (not om is of1).output
96 (om is op).output
97 (om is om).output
98 (not om is o1).output