diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-03-16 23:15:34 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-03-16 23:15:34 -0500 |
| commit | 1a9911fc259a5dd5ac9a6097c4d41d6e3e50169b (patch) | |
| tree | c2e47d1547e9706032ae6b576130f466d2125675 /tests | |
| parent | 3f500898aa5b45b423348846d794463585ef34ee (diff) | |
| download | nimterop-1a9911fc259a5dd5ac9a6097c4d41d6e3e50169b.tar.gz nimterop-1a9911fc259a5dd5ac9a6097c4d41d6e3e50169b.zip | |
Add ast2 union support
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/include/tast2.h | 4 | ||||
| -rw-r--r-- | tests/tast2.nim | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h index ced3a44..90e96c6 100644 --- a/tests/include/tast2.h +++ b/tests/include/tast2.h @@ -35,8 +35,8 @@ typedef struct A20 { char a1; } A20, A21, *A21p; typedef struct A22 { int **f1; int *f2[123+132]; } A22; //Unions -//union UNION1 {int f1; }; -//typedef union UNION2 { int **f1; int abc[123+132]; } UNION2; +union U1 {int f1; float f2; }; +typedef union U2 { int **f1; int abc[123+132]; } U2; // Anonymous //typedef struct { char a1; }; diff --git a/tests/tast2.nim b/tests/tast2.nim index dd8fae7..d8d18a3 100644 --- a/tests/tast2.nim +++ b/tests/tast2.nim @@ -71,4 +71,10 @@ assert A21 is A20 assert A21p is ptr A20 assert A22 is object -testFields(A22, {"f1": "ptr ptr cint", "f2": "array[0..254, ptr cint]"}.toTable())
\ No newline at end of file +testFields(A22, {"f1": "ptr ptr cint", "f2": "array[0..254, ptr cint]"}.toTable()) + +assert U1 is object +assert sizeof(U1) == sizeof(cfloat) + +assert U2 is object +assert sizeof(U2) == 256 * sizeof(cint)
\ No newline at end of file |
