From 47ac31f792a8856f29ea4ac38d6b366e88ac7d34 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 9 Dec 2019 18:29:29 +0100 Subject: [PATCH] test-util: add more tests for ALIGN_POWER2 --- src/test/test-util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/test-util.c b/src/test/test-util.c index 61725bdf087..76dd72a5980 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -26,7 +26,19 @@ static void test_align_power2(void) { assert_se(ALIGN_POWER2(1) == 1); assert_se(ALIGN_POWER2(2) == 2); assert_se(ALIGN_POWER2(3) == 4); + assert_se(ALIGN_POWER2(4) == 4); + assert_se(ALIGN_POWER2(5) == 8); + assert_se(ALIGN_POWER2(6) == 8); + assert_se(ALIGN_POWER2(7) == 8); + assert_se(ALIGN_POWER2(9) == 16); + assert_se(ALIGN_POWER2(10) == 16); + assert_se(ALIGN_POWER2(11) == 16); assert_se(ALIGN_POWER2(12) == 16); + assert_se(ALIGN_POWER2(13) == 16); + assert_se(ALIGN_POWER2(14) == 16); + assert_se(ALIGN_POWER2(15) == 16); + assert_se(ALIGN_POWER2(16) == 16); + assert_se(ALIGN_POWER2(17) == 32); assert_se(ALIGN_POWER2(ULONG_MAX) == 0); assert_se(ALIGN_POWER2(ULONG_MAX - 1) == 0); -- 2.47.3