2019-02-26 09:28:09 +08:00
|
|
|
const std = @import("std");
|
|
|
|
const mem = std.mem;
|
|
|
|
const expect = std.testing.expect;
|
|
|
|
const Keys = struct {
|
|
|
|
up: bool,
|
|
|
|
down: bool,
|
|
|
|
left: bool,
|
|
|
|
right: bool,
|
|
|
|
};
|
|
|
|
var keys: Keys = undefined;
|
|
|
|
test "zero keys with @memset" {
|
2019-12-10 04:56:19 +08:00
|
|
|
@memset(@ptrCast([*]u8, &keys), 0, @sizeOf(@TypeOf(keys)));
|
2021-05-05 02:23:22 +08:00
|
|
|
try expect(!keys.up);
|
|
|
|
try expect(!keys.down);
|
|
|
|
try expect(!keys.left);
|
|
|
|
try expect(!keys.right);
|
2019-02-26 09:28:09 +08:00
|
|
|
}
|