mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
This has no business being here. Tests for our compiler-rt routines should be in compiler-rt, and tests for our C ABI compliance should be in `test-c-abi`.
29 lines
463 B
C
29 lines
463 B
C
#include <assert.h>
|
|
#include <complex.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef struct {
|
|
int val;
|
|
} STest;
|
|
|
|
int getVal(STest* data) { return data->val; }
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
STest* data = (STest*)malloc(sizeof(STest));
|
|
data->val = 123;
|
|
|
|
assert(getVal(data) != 456);
|
|
int ok = (getVal(data) == 123);
|
|
|
|
if (argc > 1) {
|
|
fprintf(stdout, "val=%d\n", data->val);
|
|
}
|
|
|
|
free(data);
|
|
|
|
if (!ok) abort();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|