mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Add run-translated-c test
This commit is contained in:
parent
cd39f6df95
commit
eca294cd23
@ -3,6 +3,23 @@ const tests = @import("tests.zig");
|
||||
const nl = std.cstr.line_sep;
|
||||
|
||||
pub fn addCases(cases: *tests.RunTranslatedCContext) void {
|
||||
cases.add("boolean values and expressions",
|
||||
\\#include <stdlib.h>
|
||||
\\static const _Bool false_val = 0;
|
||||
\\static const _Bool true_val = 1;
|
||||
\\void foo(int x, int y) {
|
||||
\\ _Bool r = x < y;
|
||||
\\ if (!r) abort();
|
||||
\\ _Bool self = foo;
|
||||
\\ if (self == false_val) abort();
|
||||
\\}
|
||||
\\int main(int argc, char **argv) {
|
||||
\\ foo(2, 5);
|
||||
\\ if (false_val == true_val) abort();
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
|
||||
cases.add("hello world",
|
||||
\\#define _NO_CRT_STDIO_INLINE 1
|
||||
\\#include <stdio.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user