aboutsummaryrefslogtreecommitdiff
path: root/examples/monorepo/packages/alpha/src
diff options
context:
space:
mode:
authorDavid Czihak <git@dcz.at>2026-05-09 13:01:50 +0200
committerDavid Czihak <git@dcz.at>2026-05-09 13:01:50 +0200
commit4b6f66fd512c254b5a82220dc77411fe391dd258 (patch)
tree7d77d7966e9ad2e296986ea8cfeb607088028195 /examples/monorepo/packages/alpha/src
parent64e9c56fc665972fdde5234c4fb2f2a882e237dc (diff)
Chore: Rework examples for thorough extension testing
Diffstat (limited to 'examples/monorepo/packages/alpha/src')
-rw-r--r--examples/monorepo/packages/alpha/src/lib.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/monorepo/packages/alpha/src/lib.zig b/examples/monorepo/packages/alpha/src/lib.zig
new file mode 100644
index 0000000..2aa7716
--- /dev/null
+++ b/examples/monorepo/packages/alpha/src/lib.zig
@@ -0,0 +1,23 @@
+const std = @import("std");
+
+/// Double a value.
+pub fn double(x: i32) i32 {
+ return x * 2;
+}
+
+/// Square a value.
+pub fn square(x: i32) i32 {
+ return x * x;
+}
+
+test "alpha: double" {
+ try std.testing.expectEqual(@as(i32, 8), double(4));
+ try std.testing.expectEqual(@as(i32, -6), double(-3));
+ try std.testing.expectEqual(@as(i32, 0), double(0));
+}
+
+test "alpha: square" {
+ try std.testing.expectEqual(@as(i32, 9), square(3));
+ try std.testing.expectEqual(@as(i32, 9), square(-3));
+ try std.testing.expectEqual(@as(i32, 0), square(0));
+}