1const std = @import("std");
2const string = []const u8;
3const extras = @import("./lib.zig");
4
5/// ?A == A fails
6/// ?A == @as(?A, b) works
7/// Sourced from https://github.com/ziglang/zig/issues/12609
8pub fn is(a: anytype, b: @TypeOf(a)) bool {
9 return a == b;
10}
11
12test {
13 try std.testing.expect(is(@as(u8, 5), 5));
14}
15test {
16 try std.testing.expect(is(@as(?u8, 5), 5));
17}
18test {
19 try std.testing.expect(!is(@as(u8, 5), 8));
20}
21test {
22 try std.testing.expect(!is(@as(?u8, 5), 8));
23}