test: add fibonacci golden test, expand GOLDEN_TESTS

This commit is contained in:
2026-06-07 16:10:05 +03:00
parent e1038059c2
commit 9dd964dc48
4 changed files with 2997 additions and 1 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ selfhost: build
.PHONY: test-golden .PHONY: test-golden
GOLDEN_TESTS := hello GOLDEN_TESTS := hello fibonacci
test-golden: build test-golden: build
@echo "=== Golden tests ===" @echo "=== Golden tests ==="
+6
View File
@@ -0,0 +1,6 @@
[Package]
Name = "fibonacci"
Version = "0.1.0"
Type = "bin"
[Build]
Output = "Bin"
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
// Fibonacci - Recursive function with while loop
import Std::Io::{PrintLine};
import Std::Fmt::{Fmt_Fmt1};
func Fibonacci(n: int) -> int {
if n <= 1 {
return n;
}
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
func Main() -> int {
PrintLine("Fibonacci sequence:");
var i: int = 0;
while i < 10 {
let fib: int = Fibonacci(i);
PrintLine(Fmt_Fmt1("{0}", String_FromInt(fib)));
i = i + 1;
}
return 0;
}