authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-01-06 00:18:26+01:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-01-06 00:18:26+01:00
logeca294cd23b3b1cdb4a94fb37dfe52eeb0a7c51d
tree6b60e04342c0b1fdf81fe33f86c8f4f89a186522
parentcd39f6df957886f4b40a30b3bd02148abcac16b0

Add run-translated-c test


1 files changed, 17 insertions(+), 0 deletions(-)

test/run_translated_c.zig+17
......@@ -3,6 +3,23 @@ const tests = @import("tests.zig");
33const nl = std.cstr.line_sep;
44
55pub 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
623 cases.add("hello world",
724 \\#define _NO_CRT_STDIO_INLINE 1
825 \\#include <stdio.h>