]> Nishi Git Mirror - gwion.git/commitdiff
:white_check_mark: Add tests
authorfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 20 Sep 2019 22:55:42 +0000 (00:55 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 20 Sep 2019 22:55:42 +0000 (00:55 +0200)
tests/internal_op/conditionnal.gw [new file with mode: 0644]
tests/internal_op/implicit.gw [new file with mode: 0644]
tests/internal_op/unconditionnal.gw [new file with mode: 0644]

diff --git a/tests/internal_op/conditionnal.gw b/tests/internal_op/conditionnal.gw
new file mode 100644 (file)
index 0000000..acbd9dc
--- /dev/null
@@ -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) <<<c.i>>>;
diff --git a/tests/internal_op/implicit.gw b/tests/internal_op/implicit.gw
new file mode 100644 (file)
index 0000000..dc7f42f
--- /dev/null
@@ -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 (file)
index 0000000..623a1d0
--- /dev/null
@@ -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) <<<c.i>>>;