mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-08-26 20:29:02 +00:00
These are currently only run by the new DOIT3 test-running script. Note that these tests are designed to be applicable to most implementations of C95/C99/C11, not just ORCA/C. They do make certain assumptions not guaranteed by the standards (e.g. power of 2 types and some properties of IEEE-like FP), but in general those assumptions should be true for most 'normal' systems.
27 lines
449 B
C
27 lines
449 B
C
/*
|
|
* Test static assertions (C11).
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <assert.h>
|
|
|
|
typedef struct {
|
|
int a;
|
|
static_assert(1+1==2, "bad math");
|
|
int b;
|
|
} S1;
|
|
|
|
typedef struct {
|
|
int a;
|
|
int b;
|
|
} S2;
|
|
|
|
_Static_assert(sizeof(S1)==sizeof(S2), "strange struct sizes");
|
|
|
|
int main(void) {
|
|
static_assert(sizeof(char)==1, "bad char size");
|
|
|
|
printf ("Passed Conformance Test c11sassert\n");
|
|
return 0;
|
|
}
|