2019-08-11 09:04:35 +03:00
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
ASSERT(1, sizeof(char));
|
|
|
|
ASSERT(2, sizeof(short));
|
|
|
|
ASSERT(2, sizeof(short int));
|
|
|
|
ASSERT(2, sizeof(int short));
|
|
|
|
ASSERT(4, sizeof(int));
|
|
|
|
ASSERT(8, sizeof(long));
|
|
|
|
ASSERT(8, sizeof(long int));
|
|
|
|
ASSERT(8, sizeof(long int));
|
|
|
|
ASSERT(8, sizeof(char *));
|
|
|
|
ASSERT(8, sizeof(int *));
|
|
|
|
ASSERT(8, sizeof(long *));
|
|
|
|
ASSERT(8, sizeof(int **));
|
|
|
|
ASSERT(8, sizeof(int(*)[4]));
|
|
|
|
ASSERT(32, sizeof(int*[4]));
|
|
|
|
ASSERT(16, sizeof(int[4]));
|
|
|
|
ASSERT(48, sizeof(int[3][4]));
|
|
|
|
ASSERT(8, sizeof(struct {int a; int b;}));
|
|
|
|
|
2020-08-28 11:28:40 +03:00
|
|
|
ASSERT(8, sizeof(-10 + (long)5));
|
|
|
|
ASSERT(8, sizeof(-10 - (long)5));
|
|
|
|
ASSERT(8, sizeof(-10 * (long)5));
|
|
|
|
ASSERT(8, sizeof(-10 / (long)5));
|
|
|
|
ASSERT(8, sizeof((long)-10 + 5));
|
|
|
|
ASSERT(8, sizeof((long)-10 - 5));
|
|
|
|
ASSERT(8, sizeof((long)-10 * 5));
|
|
|
|
ASSERT(8, sizeof((long)-10 / 5));
|
|
|
|
|
2019-08-12 06:12:42 +03:00
|
|
|
ASSERT(1, ({ char i; sizeof(++i); }));
|
2020-04-13 15:44:21 +03:00
|
|
|
ASSERT(1, ({ char i; sizeof(i++); }));
|
2019-08-12 06:12:42 +03:00
|
|
|
|
2019-08-13 15:03:20 +03:00
|
|
|
ASSERT(8, sizeof(int(*)[10]));
|
|
|
|
ASSERT(8, sizeof(int(*)[][10]));
|
|
|
|
|
2020-09-20 10:11:55 +03:00
|
|
|
ASSERT(4, sizeof(struct { int x, y[]; }));
|
|
|
|
|
2019-08-26 18:21:23 +03:00
|
|
|
ASSERT(1, sizeof(char));
|
|
|
|
ASSERT(1, sizeof(signed char));
|
|
|
|
ASSERT(1, sizeof(signed char signed));
|
2020-08-28 17:29:49 +03:00
|
|
|
ASSERT(1, sizeof(unsigned char));
|
|
|
|
ASSERT(1, sizeof(unsigned char unsigned));
|
2019-08-26 18:21:23 +03:00
|
|
|
|
|
|
|
ASSERT(2, sizeof(short));
|
|
|
|
ASSERT(2, sizeof(int short));
|
|
|
|
ASSERT(2, sizeof(short int));
|
|
|
|
ASSERT(2, sizeof(signed short));
|
|
|
|
ASSERT(2, sizeof(int short signed));
|
2020-08-28 17:29:49 +03:00
|
|
|
ASSERT(2, sizeof(unsigned short));
|
|
|
|
ASSERT(2, sizeof(int short unsigned));
|
2019-08-26 18:21:23 +03:00
|
|
|
|
|
|
|
ASSERT(4, sizeof(int));
|
|
|
|
ASSERT(4, sizeof(signed int));
|
|
|
|
ASSERT(4, sizeof(signed));
|
|
|
|
ASSERT(4, sizeof(signed signed));
|
2020-08-28 17:29:49 +03:00
|
|
|
ASSERT(4, sizeof(unsigned int));
|
|
|
|
ASSERT(4, sizeof(unsigned));
|
|
|
|
ASSERT(4, sizeof(unsigned unsigned));
|
2019-08-26 18:21:23 +03:00
|
|
|
|
|
|
|
ASSERT(8, sizeof(long));
|
|
|
|
ASSERT(8, sizeof(signed long));
|
|
|
|
ASSERT(8, sizeof(signed long int));
|
2020-08-28 17:29:49 +03:00
|
|
|
ASSERT(8, sizeof(unsigned long));
|
|
|
|
ASSERT(8, sizeof(unsigned long int));
|
2019-08-26 18:21:23 +03:00
|
|
|
|
|
|
|
ASSERT(8, sizeof(long long));
|
|
|
|
ASSERT(8, sizeof(signed long long));
|
|
|
|
ASSERT(8, sizeof(signed long long int));
|
2020-08-28 17:29:49 +03:00
|
|
|
ASSERT(8, sizeof(unsigned long long));
|
|
|
|
ASSERT(8, sizeof(unsigned long long int));
|
|
|
|
|
|
|
|
ASSERT(1, sizeof((char)1));
|
|
|
|
ASSERT(2, sizeof((short)1));
|
|
|
|
ASSERT(4, sizeof((int)1));
|
|
|
|
ASSERT(8, sizeof((long)1));
|
|
|
|
|
|
|
|
ASSERT(4, sizeof((char)1 + (char)1));
|
|
|
|
ASSERT(4, sizeof((short)1 + (short)1));
|
|
|
|
ASSERT(4, sizeof(1?2:3));
|
|
|
|
ASSERT(4, sizeof(1?(short)2:(char)3));
|
|
|
|
ASSERT(8, sizeof(1?(long)2:(char)3));
|
2019-08-26 18:21:23 +03:00
|
|
|
|
2020-03-24 16:18:59 +03:00
|
|
|
ASSERT(1, sizeof(char) << 31 >> 31);
|
|
|
|
ASSERT(1, sizeof(char) << 63 >> 63);
|
|
|
|
|
2020-09-12 08:47:47 +03:00
|
|
|
ASSERT(4, sizeof(float));
|
|
|
|
ASSERT(8, sizeof(double));
|
|
|
|
|
2020-09-22 12:29:17 +03:00
|
|
|
ASSERT(4, sizeof(1f+2));
|
|
|
|
ASSERT(8, sizeof(1.0+2));
|
|
|
|
ASSERT(4, sizeof(1f-2));
|
|
|
|
ASSERT(8, sizeof(1.0-2));
|
|
|
|
ASSERT(4, sizeof(1f*2));
|
|
|
|
ASSERT(8, sizeof(1.0*2));
|
|
|
|
ASSERT(4, sizeof(1f/2));
|
|
|
|
ASSERT(8, sizeof(1.0/2));
|
|
|
|
|
2020-08-29 04:37:53 +03:00
|
|
|
ASSERT(16, sizeof(long double));
|
2020-08-26 08:51:06 +03:00
|
|
|
|
2020-07-24 15:43:48 +03:00
|
|
|
ASSERT(1, sizeof(main));
|
|
|
|
|
2019-08-11 09:04:35 +03:00
|
|
|
printf("OK\n");
|
|
|
|
return 0;
|
|
|
|
}
|