Commit db33f90c3bee8bd5780023c70dad93cc7abd88f4

Thomas de Grivel 2024-04-11T09:14:53

wip defmodule: add tests

diff --git a/ic3/.ic3_history b/ic3/.ic3_history
index 31bdbea..7e61012 100644
--- a/ic3/.ic3_history
+++ b/ic3/.ic3_history
@@ -1,3 +1,6 @@
+def fib = fn (x) { if x < 0 0 else fib(x - 2) + fib(x - 1) end }
+def fib = fn (x) { if x < 0 then 0 else fib(x - 2) + fib(x - 1) end }
+def fib = fn { (0) { 1 } (1) { 1 } (x) { if x < 0 then 0 else fib(x - 2) + fib(x - 1) end }}
 do end
 end
 do end
@@ -82,18 +85,15 @@ def List.last = fn (x) do
   y
 end
 List.last([1, 2, 3, 4])
-def List.last = fn (x) do
-  [y | z] = List.reverse(x)
-  y
-end
-List.last([1, 2, 3, 4])
-def List.last = fn (x) do
-  [y | _] = List.reverse(x)
-  y
-end
-List.last([1, 2, 3, 4])
-(Tag) ?
-(U8) ?
-type((U8) ?)
-def operator_muul = %C3.Operator{sym: :****, symbol_value: cfn Tag "tag_mul" (Tag, Tag, Result), operator_precedence: 11, operator_associativity: :left}
-2 **** 4
+[x, y | z] = List.reverse([1, 2, 3])
+x
+y
+z
+[x, y | z] = List.reverse([1, 2, 3, 4])
+x
+y
+z
+if true then true end
+if 42 then true end
+if 0 then true end
+if 0 then true else false end
diff --git a/test/ic3/defmodule.in b/test/ic3/defmodule.in
index 17ef9ec..8735c30 100644
--- a/test/ic3/defmodule.in
+++ b/test/ic3/defmodule.in
@@ -20,3 +20,17 @@ defmodule Double do
 end
 quote Double.double(21)
 Double.double(21)
+quote defmodule Plop do
+  def a = 1
+  def b = fn () { a }
+end
+defmodule Plop do
+  def a = 1
+  def b = fn () { a }
+end
+quote Plop.a
+Plop.a
+quote Plop.b
+Plop.b
+quote Plop.b()
+Plop.b()
diff --git a/test/ic3/defmodule.out.expected b/test/ic3/defmodule.out.expected
index 273bbbf..14ce49e 100644
--- a/test/ic3/defmodule.out.expected
+++ b/test/ic3/defmodule.out.expected
@@ -15,3 +15,14 @@ end
 Double
 Double.double(21)
 42
+defmodule Plop do
+  def a = 1
+  def b = fn () { a }
+end
+Plop
+Plop.a
+1
+Plop.b
+fn () { a }
+Plop.b()
+1