// findNearestZigBuildDir walk-up test: // // When this file is the active editor in Nova, the "Current Zig File" clean // action calls findNearestZigBuildDir starting at packages/beta/src/. // It finds packages/beta/build.zig after one walk step and uses that // directory as the working directory — NOT the monorepo root build.zig. // // To verify: open this file, trigger clean, observe the task console shows // the beta package directory, not the monorepo root. const std = @import("std"); /// Halve a value (integer division, truncated toward zero). pub fn halve(x: i32) i32 { return @divTrunc(x, 2); } /// Negate a value. pub fn negate(x: i32) i32 { return -x; } /// Absolute value. pub fn abs(x: i32) i32 { return if (x < 0) -x else x; } test "beta: halve" { try std.testing.expectEqual(@as(i32, 3), halve(6)); try std.testing.expectEqual(@as(i32, 3), halve(7)); // truncated try std.testing.expectEqual(@as(i32, -2), halve(-5)); try std.testing.expectEqual(@as(i32, 0), halve(0)); } test "beta: negate" { try std.testing.expectEqual(@as(i32, -7), negate(7)); try std.testing.expectEqual(@as(i32, 7), negate(-7)); try std.testing.expectEqual(@as(i32, 0), negate(0)); } test "beta: abs" { try std.testing.expectEqual(@as(i32, 5), abs(5)); try std.testing.expectEqual(@as(i32, 5), abs(-5)); try std.testing.expectEqual(@as(i32, 0), abs(0)); }