summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorJJ2023-04-12 03:24:44 +0000
committerJJ2023-04-12 03:25:42 +0000
commit7b4442af8549b212d38e8ecfbf8a62217db7b220 (patch)
tree730303e0ab14676d10bb413772f3c76d03d6bfb4 /tests/src
parent0c980d4575a210f0ff4835500bc0bee315b66a10 (diff)
https://youtu.be/GwQW3KW3DCc?t=63
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/fib.nim13
-rw-r--r--tests/src/negate.nim5
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/src/fib.nim b/tests/src/fib.nim
new file mode 100644
index 0000000..34d38f0
--- /dev/null
+++ b/tests/src/fib.nim
@@ -0,0 +1,13 @@
+# fake nim
+
+func fib(x): int -> int =
+ if eq(x, 0):
+ 0
+ else:
+ if eq(x, 1):
+ 1
+ else: # comment
+ add(fib(sub(x, 1)), fib(sub(x, 2)))
+
+negate(negate(1))
+fib(5)
diff --git a/tests/src/negate.nim b/tests/src/negate.nim
new file mode 100644
index 0000000..c775e74
--- /dev/null
+++ b/tests/src/negate.nim
@@ -0,0 +1,5 @@
+func negate(x): bool -> bool =
+ if x:
+ 0
+ else:
+ 1