Diff
diff --git a/tests/keybind_tests.zig b/tests/keybind_tests.zig
deleted file mode 100644
index ad8814c..0000000
--- a/tests/keybind_tests.zig
+++ /dev/null
@@ -1,137 +0,0 @@
-const std = @import("std");
-const testing = std.testing;
-
-const Mod4Mask: u32 = 1 << 6;
-const Mod1Mask: u32 = 1 << 3;
-const ShiftMask: u32 = 1 << 0;
-const ControlMask: u32 = 1 << 2;
-
-fn parse_modifier(name: []const u8) u32 {
- if (std.mem.eql(u8, name, "Mod4") or std.mem.eql(u8, name, "mod4") or std.mem.eql(u8, name, "super")) {
- return Mod4Mask;
- } else if (std.mem.eql(u8, name, "Mod1") or std.mem.eql(u8, name, "mod1") or std.mem.eql(u8, name, "alt")) {
- return Mod1Mask;
- } else if (std.mem.eql(u8, name, "Shift") or std.mem.eql(u8, name, "shift")) {
- return ShiftMask;
- } else if (std.mem.eql(u8, name, "Control") or std.mem.eql(u8, name, "control") or std.mem.eql(u8, name, "ctrl")) {
- return ControlMask;
- }
- return 0;
-}
-
-fn parse_modifiers(names: []const []const u8) u32 {
- var mask: u32 = 0;
- for (names) |name| {
- mask |= parse_modifier(name);
- }
- return mask;
-}
-
-test "parse_modifier: Mod4 variants" {
- try testing.expectEqual(Mod4Mask, parse_modifier("Mod4"));
- try testing.expectEqual(Mod4Mask, parse_modifier("mod4"));
- try testing.expectEqual(Mod4Mask, parse_modifier("super"));
-}
-
-test "parse_modifier: Mod1 (Alt) variants" {
- try testing.expectEqual(Mod1Mask, parse_modifier("Mod1"));
- try testing.expectEqual(Mod1Mask, parse_modifier("mod1"));
- try testing.expectEqual(Mod1Mask, parse_modifier("alt"));
-}
-
-test "parse_modifier: Shift variants" {
- try testing.expectEqual(ShiftMask, parse_modifier("Shift"));
- try testing.expectEqual(ShiftMask, parse_modifier("shift"));
-}
-
-test "parse_modifier: Control variants" {
- try testing.expectEqual(ControlMask, parse_modifier("Control"));
- try testing.expectEqual(ControlMask, parse_modifier("control"));
- try testing.expectEqual(ControlMask, parse_modifier("ctrl"));
-}
-
-test "parse_modifier: unknown returns 0" {
- try testing.expectEqual(@as(u32, 0), parse_modifier("Unknown"));
- try testing.expectEqual(@as(u32, 0), parse_modifier(""));
-}
-
-test "parse_modifiers: combines multiple modifiers" {
- const mods = &[_][]const u8{ "Mod4", "Shift" };
- try testing.expectEqual(Mod4Mask | ShiftMask, parse_modifiers(mods));
-}
-
-test "parse_modifiers: triple combination" {
- const mods = &[_][]const u8{ "super", "shift", "ctrl" };
- try testing.expectEqual(Mod4Mask | ShiftMask | ControlMask, parse_modifiers(mods));
-}
-
-test "parse_modifiers: empty list returns 0" {
- const mods = &[_][]const u8{};
- try testing.expectEqual(@as(u32, 0), parse_modifiers(mods));
-}
-
-fn key_name_to_keysym(name: []const u8) ?u64 {
- const key_map = .{
- .{ "Return", 0xff0d },
- .{ "Enter", 0xff0d },
- .{ "Tab", 0xff09 },
- .{ "Escape", 0xff1b },
- .{ "BackSpace", 0xff08 },
- .{ "Delete", 0xffff },
- .{ "space", 0x0020 },
- .{ "Space", 0x0020 },
- };
-
- inline for (key_map) |entry| {
- if (std.mem.eql(u8, name, entry[0])) {
- return entry[1];
- }
- }
-
- if (name.len == 1) {
- const char = name[0];
- if (char >= 'a' and char <= 'z') {
- return char;
- }
- if (char >= 'A' and char <= 'Z') {
- return char + 32;
- }
- if (char >= '0' and char <= '9') {
- return char;
- }
- }
-
- return null;
-}
-
-test "key_name_to_keysym: special keys" {
- try testing.expectEqual(@as(?u64, 0xff0d), key_name_to_keysym("Return"));
- try testing.expectEqual(@as(?u64, 0xff0d), key_name_to_keysym("Enter"));
- try testing.expectEqual(@as(?u64, 0xff09), key_name_to_keysym("Tab"));
- try testing.expectEqual(@as(?u64, 0xff1b), key_name_to_keysym("Escape"));
-}
-
-test "key_name_to_keysym: lowercase letters" {
- try testing.expectEqual(@as(?u64, 'a'), key_name_to_keysym("a"));
- try testing.expectEqual(@as(?u64, 'z'), key_name_to_keysym("z"));
-}
-
-test "key_name_to_keysym: uppercase converts to lowercase" {
- try testing.expectEqual(@as(?u64, 'a'), key_name_to_keysym("A"));
- try testing.expectEqual(@as(?u64, 'z'), key_name_to_keysym("Z"));
-}
-
-test "key_name_to_keysym: numbers" {
- try testing.expectEqual(@as(?u64, '0'), key_name_to_keysym("0"));
- try testing.expectEqual(@as(?u64, '9'), key_name_to_keysym("9"));
-}
-
-test "key_name_to_keysym: unknown returns null" {
- try testing.expectEqual(@as(?u64, null), key_name_to_keysym("UnknownKey"));
- try testing.expectEqual(@as(?u64, null), key_name_to_keysym(""));
-}
-
-test "key_name_to_keysym: space variants" {
- try testing.expectEqual(@as(?u64, 0x0020), key_name_to_keysym("space"));
- try testing.expectEqual(@as(?u64, 0x0020), key_name_to_keysym("Space"));
-}
diff --git a/tests/layout_tests.zig b/tests/layout_tests.zig
deleted file mode 100644
index 3481b62..0000000
--- a/tests/layout_tests.zig
+++ /dev/null
@@ -1,138 +0,0 @@
-const std = @import("std");
-const testing = std.testing;
-
-const Rect = struct {
- x: i32,
- y: i32,
- w: i32,
- h: i32,
-};
-
-fn calculate_master_stack_layout(
- area: Rect,
- num_clients: usize,
- num_master: usize,
- master_factor: f32,
- gap: i32,
-) []Rect {
- var rects: [16]Rect = undefined;
- if (num_clients == 0) return rects[0..0];
-
- const actual_master = @min(num_master, num_clients);
- const stack_count = if (num_clients > actual_master) num_clients - actual_master else 0;
-
- const master_width: i32 = if (stack_count > 0)
- @intFromFloat(@as(f32, @floatFromInt(area.w - gap)) * master_factor)
- else
- area.w;
-
- var i: usize = 0;
- while (i < actual_master) : (i += 1) {
- const h = @divTrunc(area.h - @as(i32, @intCast(actual_master - 1)) * gap, @as(i32, @intCast(actual_master)));
- rects[i] = .{
- .x = area.x,
- .y = area.y + @as(i32, @intCast(i)) * (h + gap),
- .w = master_width,
- .h = h,
- };
- }
-
- const stack_width = area.w - master_width - gap;
- var j: usize = 0;
- while (j < stack_count) : (j += 1) {
- const h = @divTrunc(area.h - @as(i32, @intCast(stack_count - 1)) * gap, @as(i32, @intCast(stack_count)));
- rects[actual_master + j] = .{
- .x = area.x + master_width + gap,
- .y = area.y + @as(i32, @intCast(j)) * (h + gap),
- .w = stack_width,
- .h = h,
- };
- }
-
- return rects[0..num_clients];
-}
-
-test "tiling layout: single window fills area" {
- const area = Rect{ .x = 0, .y = 0, .w = 800, .h = 600 };
- const rects = calculate_master_stack_layout(area, 1, 1, 0.55, 5);
-
- try testing.expectEqual(@as(usize, 1), rects.len);
- try testing.expectEqual(@as(i32, 0), rects[0].x);
- try testing.expectEqual(@as(i32, 0), rects[0].y);
- try testing.expectEqual(@as(i32, 800), rects[0].w);
- try testing.expectEqual(@as(i32, 600), rects[0].h);
-}
-
-test "tiling layout: two windows split horizontally" {
- const area = Rect{ .x = 0, .y = 0, .w = 800, .h = 600 };
- const rects = calculate_master_stack_layout(area, 2, 1, 0.5, 0);
-
- try testing.expectEqual(@as(usize, 2), rects.len);
- try testing.expectEqual(@as(i32, 400), rects[0].w);
- try testing.expectEqual(@as(i32, 400), rects[1].w);
-}
-
-test "tiling layout: respects master factor" {
- const area = Rect{ .x = 0, .y = 0, .w = 1000, .h = 600 };
- const rects = calculate_master_stack_layout(area, 2, 1, 0.6, 0);
-
- try testing.expectEqual(@as(usize, 2), rects.len);
- try testing.expectEqual(@as(i32, 600), rects[0].w);
- try testing.expectEqual(@as(i32, 400), rects[1].w);
-}
-
-test "tiling layout: no clients returns empty" {
- const area = Rect{ .x = 0, .y = 0, .w = 800, .h = 600 };
- const rects = calculate_master_stack_layout(area, 0, 1, 0.55, 5);
-
- try testing.expectEqual(@as(usize, 0), rects.len);
-}
-
-test "tiling layout: multiple stack windows divide height" {
- const area = Rect{ .x = 0, .y = 0, .w = 800, .h = 600 };
- const rects = calculate_master_stack_layout(area, 3, 1, 0.5, 0);
-
- try testing.expectEqual(@as(usize, 3), rects.len);
- try testing.expectEqual(@as(i32, 600), rects[0].h);
- try testing.expectEqual(@as(i32, 300), rects[1].h);
- try testing.expectEqual(@as(i32, 300), rects[2].h);
-}
-
-fn calculate_monocle_layout(area: Rect, num_clients: usize) []Rect {
- var rects: [16]Rect = undefined;
- if (num_clients == 0) return rects[0..0];
-
- var i: usize = 0;
- while (i < num_clients) : (i += 1) {
- rects[i] = area;
- }
- return rects[0..num_clients];
-}
-
-test "monocle layout: all windows get full area" {
- const area = Rect{ .x = 0, .y = 0, .w = 800, .h = 600 };
- const rects = calculate_monocle_layout(area, 3);
-
- try testing.expectEqual(@as(usize, 3), rects.len);
- for (rects) |rect| {
- try testing.expectEqual(@as(i32, 0), rect.x);
- try testing.expectEqual(@as(i32, 0), rect.y);
- try testing.expectEqual(@as(i32, 800), rect.w);
- try testing.expectEqual(@as(i32, 600), rect.h);
- }
-}
-
-test "monocle layout: no clients returns empty" {
- const area = Rect{ .x = 0, .y = 0, .w = 800, .h = 600 };
- const rects = calculate_monocle_layout(area, 0);
-
- try testing.expectEqual(@as(usize, 0), rects.len);
-}
-
-test "monocle layout: respects area offset" {
- const area = Rect{ .x = 100, .y = 50, .w = 800, .h = 600 };
- const rects = calculate_monocle_layout(area, 1);
-
- try testing.expectEqual(@as(i32, 100), rects[0].x);
- try testing.expectEqual(@as(i32, 50), rects[0].y);
-}
diff --git a/tests/main_tests.zig b/tests/main_tests.zig
index c007a5c..1a9df07 100644
--- a/tests/main_tests.zig
+++ b/tests/main_tests.zig
@@ -2,6 +2,4 @@ const std = @import("std");
test {
_ = @import("config_tests.zig");
- _ = @import("layout_tests.zig");
- _ = @import("keybind_tests.zig");
}