From a1e397e28f18ace43ed7d401dc556bbddec968f3 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sat, 21 Sep 2019 00:55:42 +0200 Subject: [PATCH] :white_check_mark: Add tests --- tests/internal_op/conditionnal.gw | 11 +++++++++++ tests/internal_op/implicit.gw | 12 ++++++++++++ tests/internal_op/unconditionnal.gw | 11 +++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/internal_op/conditionnal.gw create mode 100644 tests/internal_op/implicit.gw create mode 100644 tests/internal_op/unconditionnal.gw diff --git a/tests/internal_op/conditionnal.gw b/tests/internal_op/conditionnal.gw new file mode 100644 index 00000000..acbd9dc2 --- /dev/null +++ b/tests/internal_op/conditionnal.gw @@ -0,0 +1,11 @@ +#! [contains] 1 +class C { 10 => int i; } + +operator @conditionnal int(C c) { + <<< __func__ >>>; + --c.i; + return c.i; +} + +C c; +while(c) <<>>; diff --git a/tests/internal_op/implicit.gw b/tests/internal_op/implicit.gw new file mode 100644 index 00000000..dc7f42f0 --- /dev/null +++ b/tests/internal_op/implicit.gw @@ -0,0 +1,12 @@ +#! [contains] 12 +class C { + 12 => int i; +} + +operator @implicit int (C c) { + return c.i; +} + +fun void test(int i) { <<< i >>>; } +C c; +c => test; diff --git a/tests/internal_op/unconditionnal.gw b/tests/internal_op/unconditionnal.gw new file mode 100644 index 00000000..623a1d0c --- /dev/null +++ b/tests/internal_op/unconditionnal.gw @@ -0,0 +1,11 @@ +#! [contains] 1 +class C { 10 => int i; } + +operator @unconditionnal int(C c) { + <<< __func__ >>>; + --c.i; + return !c.i; +} + +C c; +until(c) <<>>; -- 2.43.0