| ... | ... | @@ -3,6 +3,23 @@ const tests = @import("tests.zig"); |
| 3 | 3 | const nl = std.cstr.line_sep; |
| 4 | 4 | |
| 5 | 5 | pub fn addCases(cases: *tests.RunTranslatedCContext) void { |
| 6 | cases.add("boolean values and expressions", |
| 7 | \\#include <stdlib.h> |
| 8 | \\static const _Bool false_val = 0; |
| 9 | \\static const _Bool true_val = 1; |
| 10 | \\void foo(int x, int y) { |
| 11 | \\ _Bool r = x < y; |
| 12 | \\ if (!r) abort(); |
| 13 | \\ _Bool self = foo; |
| 14 | \\ if (self == false_val) abort(); |
| 15 | \\} |
| 16 | \\int main(int argc, char **argv) { |
| 17 | \\ foo(2, 5); |
| 18 | \\ if (false_val == true_val) abort(); |
| 19 | \\ return 0; |
| 20 | \\} |
| 21 | , ""); |
| 22 | |
| 6 | 23 | cases.add("hello world", |
| 7 | 24 | \\#define _NO_CRT_STDIO_INLINE 1 |
| 8 | 25 | \\#include <stdio.h> |