From f815e78e5f622e46ef58de0d83ca65c3b04b2b79 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 23 Apr 2015 15:45:41 +0700 Subject: [PATCH] tests: improve (and rename) test_operators.nit Signed-off-by: Jean Privat --- tests/{test_operators.nit => base_operators.nit} | 50 ++++++++++++++++++++-- tests/sav/base_operators.res | 32 ++++++++++++++ tests/sav/test_operators.res | 14 ------ 3 files changed, 79 insertions(+), 17 deletions(-) rename tests/{test_operators.nit => base_operators.nit} (75%) create mode 100644 tests/sav/base_operators.res delete mode 100644 tests/sav/test_operators.res diff --git a/tests/test_operators.nit b/tests/base_operators.nit similarity index 75% rename from tests/test_operators.nit rename to tests/base_operators.nit index d828220..e993cc9 100644 --- a/tests/test_operators.nit +++ b/tests/base_operators.nit @@ -1,7 +1,5 @@ # This file is part of NIT ( http://www.nitlanguage.org ). # -# Copyright 2004-2008 Jean Privat -# # 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 @@ -14,8 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import standard::kernel class A + fun +: A + do + 0.output + return self + end fun +(a: A): A do 2.output @@ -86,6 +90,31 @@ class A 15.output return a end + fun **(a: A): A + do + 16.output + return a + end + fun |(a: A): A + do + 16.output + return a + end + fun ^(a: A): A + do + 17.output + return a + end + fun &(a: A): A + do + 18.output + return a + end + fun ~: A + do + 19.output + return self + end init do end end @@ -94,6 +123,21 @@ var a = new A var a2 = new A var b : Bool var i: Int -a = a + -a - a * a / a % a >> a << a + +a = +a + -a - a * a / a % a >> a << a ** a | ~a ^ a & a b = a == a2 and a < a and a > a and a <= a and a >= a i = a <=> a + +'\n'.output + +a += a +a -= a +a *= a +a /= a +a %= a +a **= a +a <<= a +a >>= a +a |= a +a ^= a +a &= a diff --git a/tests/sav/base_operators.res b/tests/sav/base_operators.res new file mode 100644 index 0000000..9533fc2 --- /dev/null +++ b/tests/sav/base_operators.res @@ -0,0 +1,32 @@ +0 +1 +2 +3 +4 +5 +6 +15 +16 +14 +19 +18 +17 +16 +7 +9 +10 +11 +12 +13 + +2 +6 +3 +4 +5 +16 +14 +15 +16 +17 +18 diff --git a/tests/sav/test_operators.res b/tests/sav/test_operators.res deleted file mode 100644 index cf2273e..0000000 --- a/tests/sav/test_operators.res +++ /dev/null @@ -1,14 +0,0 @@ -1 -2 -3 -4 -5 -6 -15 -14 -7 -9 -10 -11 -12 -13 -- 1.7.9.5