tests: add test_coll_eq
authorJean Privat <jean@pryen.org>
Tue, 19 May 2015 16:09:32 +0000 (12:09 -0400)
committerJean Privat <jean@pryen.org>
Tue, 19 May 2015 23:43:24 +0000 (19:43 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/sav/test_coll_eq.res [new file with mode: 0644]
tests/test_coll_eq.nit [new file with mode: 0644]

diff --git a/tests/sav/test_coll_eq.res b/tests/sav/test_coll_eq.res
new file mode 100644 (file)
index 0000000..abe1e00
--- /dev/null
@@ -0,0 +1,13 @@
+true
+true
+true
+true
+true
+true
+
+true
+true
+true
+
+true
+hello
diff --git a/tests/test_coll_eq.nit b/tests/test_coll_eq.nit
new file mode 100644 (file)
index 0000000..bf13bd9
--- /dev/null
@@ -0,0 +1,38 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var a = [1,2,3]
+var l = new List[Int].from(a)
+var l2 = new List[Object].from(a)
+
+print a == l
+print a == l2
+print l == a
+print l == l2
+print l2 == a
+print l2 == l
+print ""
+
+var aa = [a]
+print aa.has(a)
+print aa.has(l)
+print aa.has(l2)
+print ""
+
+var map = new Map[List[Int], String]
+map[l] = "hello"
+
+var mapr: MapRead[Object, String] = map
+print mapr.has_key(a)
+print mapr[l2]