tests: translate-c and run-translated-c to the test harness

This commit is contained in:
Veikka Tuominen
2023-10-14 22:02:32 +03:00
parent 58b07ea14f
commit e765495b11
17 changed files with 338 additions and 71 deletions

View File

@@ -2,17 +2,14 @@ const std = @import("std");
const tests = @import("tests.zig");
const nl = if (@import("builtin").os.tag == .windows) "\r\n" else "\n";
pub fn addCases(cases: *tests.RunTranslatedCContext) void {
cases.add("dereference address of",
\\#include <stdlib.h>
\\int main(void) {
\\ int i = 0;
\\ *&i = 42;
\\ if (i != 42) abort();
\\ return 0;
\\}
, "");
// *********************************************************
// * *
// * DO NOT ADD NEW CASES HERE *
// * instead add a file to test/cases/run_translated_c *
// * *
// *********************************************************
pub fn addCases(cases: *tests.RunTranslatedCContext) void {
cases.add("division of floating literals",
\\#define _NO_CRT_STDIO_INLINE 1
\\#include <stdio.h>