| author | |
| committer | |
| log | 520397b48fac7fd0c107257c57f2cca4f0a40a98 |
| tree | f4b839aa2c6f2ed630c45823f6d678f171e7153e |
| parent | 7248b4a4e437223a0c826dfbcb76b9835fce16d0 |
These were originally supposed to be incremental test cases but have
long since been made redundant.2 files changed, 0 insertions(+), 58 deletions(-)
test/cases/function_pointers.zig deleted-30| ... | @@ -1,30 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | const PrintFn = *const fn () void; | ||
| 4 | |||
| 5 | pub fn main() void { | ||
| 6 | var printFn: PrintFn = stopSayingThat; | ||
| 7 | var i: u32 = 0; | ||
| 8 | while (i < 4) : (i += 1) printFn(); | ||
| 9 | |||
| 10 | printFn = moveEveryZig; | ||
| 11 | printFn(); | ||
| 12 | } | ||
| 13 | |||
| 14 | fn stopSayingThat() void { | ||
| 15 | _ = std.posix.write(1, "Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n") catch {}; | ||
| 16 | } | ||
| 17 | |||
| 18 | fn moveEveryZig() void { | ||
| 19 | _ = std.posix.write(1, "All your codebase are belong to us\n") catch {}; | ||
| 20 | } | ||
| 21 | |||
| 22 | // run | ||
| 23 | // target=x86_64-macos | ||
| 24 | // | ||
| 25 | // Hello, my name is Inigo Montoya; you killed my father, prepare to die. | ||
| 26 | // Hello, my name is Inigo Montoya; you killed my father, prepare to die. | ||
| 27 | // Hello, my name is Inigo Montoya; you killed my father, prepare to die. | ||
| 28 | // Hello, my name is Inigo Montoya; you killed my father, prepare to die. | ||
| 29 | // All your codebase are belong to us | ||
| 30 | // | ||
test/cases/print_u32s.zig deleted-28| ... | @@ -1,28 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | printNumberHex(0x00000000); | ||
| 5 | printNumberHex(0xaaaaaaaa); | ||
| 6 | printNumberHex(0xdeadbeef); | ||
| 7 | printNumberHex(0x31415926); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn printNumberHex(x: u32) void { | ||
| 11 | const digit_chars = "0123456789abcdef"; | ||
| 12 | var i: u5 = 28; | ||
| 13 | while (true) : (i -= 4) { | ||
| 14 | const digit = (x >> i) & 0xf; | ||
| 15 | _ = std.posix.write(1, &.{digit_chars[digit]}) catch {}; | ||
| 16 | if (i == 0) break; | ||
| 17 | } | ||
| 18 | _ = std.posix.write(1, "\n") catch {}; | ||
| 19 | } | ||
| 20 | |||
| 21 | // run | ||
| 22 | // target=x86_64-macos | ||
| 23 | // | ||
| 24 | // 00000000 | ||
| 25 | // aaaaaaaa | ||
| 26 | // deadbeef | ||
| 27 | // 31415926 | ||
| 28 | // | ||