First NIT release and new clean mercurial repository
[nit.git] / tests / test_eq2.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 var i = 1
18 var j = 1
19 var k = 2
20 var s = "Maison"
21 var t = "Maison"
22 var u = "Arbre"
23 var a: Object
24 var b: Object
25 print("* literal int")
26 print(1 == 1)
27 print(not 1 != 1)
28 print(not 1 == 2)
29 print(1 != 2)
30 print("* int variable")
31 print(i == j)
32 print(j == i)
33 print(i != k)
34 print(i == 1)
35 print(i != 2)
36
37 print("* same type object")
38 print(s == s)
39 a = s
40 print(a == s)
41 a = s
42 print(s == t)
43 b = t
44 print(b == s)
45 print(not s == u)
46 b = u
47 print(not b == s)
48
49 print("* different type object")
50 a = s.iterator
51 print(not a == s)
52 a = 5
53 print(not a == s)
54
55 print("* boxed native")
56 a = i
57 b = i
58 print(a == i)
59 print(b == i)
60 print(b == a)
61 a = 5
62 b = 5.ascii
63 print(not a == 5.ascii)
64 print(not b == 5)
65 print(not a == b)