diff options
author | Jan Janssen <medhefgo@web.de> | 2021-10-06 10:21:42 +0200 |
---|---|---|
committer | Jan Janssen <medhefgo@web.de> | 2021-10-17 11:56:05 +0200 |
commit | a36a0d154038797fdf360b7b5705f001e2900775 (patch) | |
tree | 04afbed642d21312e309a1c885d66b4208997538 /src/test/test-macro.c | |
parent | 53f69d671c024698d5911a984ef8888ad4523fc1 (diff) | |
download | systemd-a36a0d154038797fdf360b7b5705f001e2900775.tar.gz |
macro: Move ALIGN_TO to macro-fundamental.h and introduce CONST_ALIGN_TO
Diffstat (limited to 'src/test/test-macro.c')
-rw-r--r-- | src/test/test-macro.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test-macro.c b/src/test/test-macro.c index 4acbbfb7af..495221c1d5 100644 --- a/src/test/test-macro.c +++ b/src/test/test-macro.c @@ -325,6 +325,15 @@ static void test_align_to(void) { assert_se(ALIGN_TO(SIZE_MAX-2, 4) == SIZE_MAX); /* overflow */ assert_se(ALIGN_TO(SIZE_MAX-1, 4) == SIZE_MAX); /* overflow */ assert_se(ALIGN_TO(SIZE_MAX, 4) == SIZE_MAX); /* overflow */ + + assert_cc(CONST_ALIGN_TO(96, 512) == 512); + assert_cc(CONST_ALIGN_TO(511, 512) == 512); + assert_cc(CONST_ALIGN_TO(512, 512) == 512); + assert_cc(CONST_ALIGN_TO(513, 512) == 1024); + assert_cc(CONST_ALIGN_TO(sizeof(int), 64) == 64); + + assert_cc(__builtin_types_compatible_p(typeof(CONST_ALIGN_TO(4, 3)), void)); + assert_cc(__builtin_types_compatible_p(typeof(CONST_ALIGN_TO(SIZE_MAX, 512)), void)); } int main(int argc, char *argv[]) { |