about summary refs log tree commit diff stats
path: root/apps/factorial.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-02-10 00:57:31 -0800
committerKartik Agaram <vc@akkartik.com>2020-02-14 01:46:37 -0800
commit1f029c3b5733540aec775117dfa1d03447d563db (patch)
tree304ae5e42986869743a8f9210be5a5d37322801a /apps/factorial.mu
parent0be8e8007299be1eaaf778e3539b2eafcb637c8b (diff)
downloadmu-1f029c3b5733540aec775117dfa1d03447d563db.tar.gz
6005
Support calling SubX code from Mu. I have _zero_ idea how to make this
safe.

Now we can start writing tests. We can't use commandline args yet. That
requires support for kernel strings.
Diffstat (limited to 'apps/factorial.mu')
-rw-r--r--apps/factorial.mu7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/factorial.mu b/apps/factorial.mu
index f306de25..5177daeb 100644
--- a/apps/factorial.mu
+++ b/apps/factorial.mu
@@ -1,4 +1,6 @@
 fn main -> result/ebx: int {
+#?   run-tests
+#?   result <- copy 0
   var tmp/eax: int <- factorial 5
   result <- copy tmp
 }
@@ -17,3 +19,8 @@ fn factorial n: int -> result/eax: int {
     result <- multiply n
   }
 }
+
+fn test-factorial {
+  var result/eax: int <- factorial 5
+  check-ints-equal result 0x78 "F - test-factorial"
+}