diff options
author | Orangerot <purple@orangerot.dev> | 2025-05-10 17:19:05 +0200 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2025-05-10 17:19:05 +0200 |
commit | 62944b57a2a83a9c0f21aa6bffaf019fbe53ea4d (patch) | |
tree | 01c560db2fbc29b8b6fe5d55a775a9b658cdcaf0 /tests |
Initial Commit
Diffstat (limited to 'tests')
-rw-r--r-- | tests/factorial.wat | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/factorial.wat b/tests/factorial.wat new file mode 100644 index 0000000..3d98dd4 --- /dev/null +++ b/tests/factorial.wat @@ -0,0 +1,19 @@ +;; SPDX-FileCopyrightText: 2025 orangerot <me@orangerot> +;; +;; SPDX-License-Identifier: GPL-3.0 + +(module + (func $fac (export "fac") (param f64) (result f64) + local.get 0 + f64.const 1 + f64.lt + if (result f64) + f64.const 1 + else + local.get 0 + local.get 0 + f64.const 1 + f64.sub + call $fac + f64.mul + end)) |