From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavan Nikhilesh Subject: [PATCH 2/2] test: update common auto test Date: Wed, 14 Mar 2018 15:11:00 +0530 Message-ID: <20180314094100.12373-2-pbhagavatula@caviumnetworks.com> References: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: dev@dpdk.org, Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, thomas@monjalon.net Return-path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0067.outbound.protection.outlook.com [104.47.32.67]) by dpdk.org (Postfix) with ESMTP id 4FB254CB3 for ; Wed, 14 Mar 2018 10:42:06 +0100 (CET) In-Reply-To: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Update common auto test to include test for aligning values to multiples of given integer. Signed-off-by: Pavan Nikhilesh --- test/test/test_common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test/test_common.c b/test/test/test_common.c index d0342430f..e43cba49b 100644 --- a/test/test/test_common.c +++ b/test/test/test_common.c @@ -128,6 +128,18 @@ test_align(void) FAIL("rte_is_aligned"); } } + + for (p = 1; p <= MAX_NUM / 2; p++) { + for (i = 1; i <= MAX_NUM / 2; i++) { + val = RTE_ALIGN_MUL_CEIL(i, p); + if (val % p != 0 || val < i) + FAIL_ALIGN("RTE_ALIGN_MUL_CEIL", i, p); + val = RTE_ALIGN_MUL_FLOOR(i, p); + if (val % p != 0 || val > i) + FAIL_ALIGN("RTE_ALIGN_MUL_FLOOR", i, p); + } + } + return 0; } -- 2.16.2