removing recursion test
All checks were successful
Build / build (push) Successful in 1m53s
Test / build (push) Successful in 5m13s

This commit is contained in:
2026-01-18 16:18:56 +01:00
parent bb40e5b33f
commit 04092e25c1
4 changed files with 69 additions and 140 deletions

View File

@@ -98,65 +98,3 @@ test "Nested function calls" {
try case.expectOutput(T, 4, code, "color", &.{ n, n, n, n });
}
}
test "Recursive function calls" {
const allocator = std.testing.allocator;
const types = [_]type{ i32, u32, f32, f64 };
inline for (types) |T| {
const iterations = 10;
const fib = struct {
fn onacci(n: T) T {
if (n <= 0) return n;
return onacci(n - 1) + onacci(n - 2);
}
};
const expected = fib.onacci(iterations);
const shader = try std.fmt.allocPrint(
allocator,
\\ [nzsl_version("1.1")]
\\ [feature(float64)]
\\ module;
\\
\\ struct FragOut
\\ {{
\\ [location(0)] color: vec4[{s}]
\\ }}
\\
\\ fn fibonacci(n: {s}) -> {s}
\\ {{
\\ if (n <= {s}(1)) return n;
\\ return fibonacci(n - {s}(1)) + fibonacci(n - {s}(2));
\\ }}
\\
\\ [entry(frag)]
\\ fn main() -> FragOut
\\ {{
\\ let output: FragOut;
\\ output.color = vec4[{s}](fibonacci({d}), fibonacci({d}), fibonacci({d}), fibonacci({d}));
\\ return output;
\\ }}
,
.{
@typeName(T),
@typeName(T),
@typeName(T),
@typeName(T),
@typeName(T),
@typeName(T),
@typeName(T),
iterations,
iterations,
iterations,
iterations,
},
);
defer allocator.free(shader);
std.debug.print("{s}\n\n", .{shader});
const code = try compileNzsl(allocator, shader);
defer allocator.free(code);
try case.expectOutput(T, 4, code, "color", &.{ expected, expected, expected, expected });
}
}