zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

test_comptime_max_with_bool.zig (278B) - Raw


      1 fn max(comptime T: type, a: T, b: T) T {
      2     if (T == bool) {
      3         return a or b;
      4     } else if (a > b) {
      5         return a;
      6     } else {
      7         return b;
      8     }
      9 }
     10 test "try to compare bools" {
     11     try @import("std").testing.expect(max(bool, false, true) == true);
     12 }
     13 
     14 // test