From 885e616a269fdafa960388e8f937f8eb2b945fe3 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 19 May 2015 12:09:32 -0400 Subject: [PATCH] tests: add test_coll_eq Signed-off-by: Jean Privat --- tests/sav/test_coll_eq.res | 13 +++++++++++++ tests/test_coll_eq.nit | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/sav/test_coll_eq.res create mode 100644 tests/test_coll_eq.nit diff --git a/tests/sav/test_coll_eq.res b/tests/sav/test_coll_eq.res new file mode 100644 index 0000000..abe1e00 --- /dev/null +++ b/tests/sav/test_coll_eq.res @@ -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 index 0000000..bf13bd9 --- /dev/null +++ b/tests/test_coll_eq.nit @@ -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] -- 1.7.9.5