From 9334f3beaf3ff16308dbdf9ea1ddbfd0f7d56c5e Mon Sep 17 00:00:00 2001 From: Lukasz Czajka Date: Tue, 10 Sep 2024 12:11:05 +0200 Subject: [PATCH] update stdlib --- juvix-stdlib | 2 +- tests/Casm/Compilation/positive/out/test078.out | 1 + tests/Casm/Compilation/positive/test078.juvix | 11 +++++++++++ tests/Casm/positive/out/test018.out | 1 + tests/Casm/positive/test018.casm | 13 +++++++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/Casm/Compilation/positive/out/test078.out create mode 100644 tests/Casm/Compilation/positive/test078.juvix create mode 100644 tests/Casm/positive/out/test018.out create mode 100644 tests/Casm/positive/test018.casm diff --git a/juvix-stdlib b/juvix-stdlib index 615a02c810..6010ad32f8 160000 --- a/juvix-stdlib +++ b/juvix-stdlib @@ -1 +1 @@ -Subproject commit 615a02c8107076ca9661c5234d41792be91a5104 +Subproject commit 6010ad32f80498432b9a14752a0b7b50e9b36763 diff --git a/tests/Casm/Compilation/positive/out/test078.out b/tests/Casm/Compilation/positive/out/test078.out new file mode 100644 index 0000000000..f6bda3a744 --- /dev/null +++ b/tests/Casm/Compilation/positive/out/test078.out @@ -0,0 +1 @@ +482630520 diff --git a/tests/Casm/Compilation/positive/test078.juvix b/tests/Casm/Compilation/positive/test078.juvix new file mode 100644 index 0000000000..151facb51e --- /dev/null +++ b/tests/Casm/Compilation/positive/test078.juvix @@ -0,0 +1,11 @@ +module test078; + +import Stdlib.Prelude open; + +fact' (acc : Nat) : Nat → Nat + | zero := acc + | (suc x) := assert (acc /= 0) >-> fact' (acc * suc x) x; + +fact : Nat → Nat := fact' 1; + +main : Nat := assert (fact 10 == 10 * fact 9) >-> fact 5 + fact 10 + fact 12; diff --git a/tests/Casm/positive/out/test018.out b/tests/Casm/positive/out/test018.out new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/tests/Casm/positive/out/test018.out @@ -0,0 +1 @@ +0 diff --git a/tests/Casm/positive/test018.casm b/tests/Casm/positive/test018.casm new file mode 100644 index 0000000000..6808accbb1 --- /dev/null +++ b/tests/Casm/positive/test018.casm @@ -0,0 +1,13 @@ +-- assertions + +start: + [ap] = 10 + [ap + 1] = 1 + ap += 2 +loop: + [ap] = [ap - 2] - 1 + [ap + 1] = [ap - 1] * [ap - 2] + ap += 2 + jmp loop if [ap - 2] != 0 + [ap] = [ap - 1] - 3628800; ap++ + assert [ap - 1]