From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8DACC433F5 for ; Sun, 6 Mar 2022 12:51:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8335783C27; Sun, 6 Mar 2022 13:51:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="GcyGd/+n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1788A83BE8; Sun, 6 Mar 2022 13:51:10 +0100 (CET) Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4624980A4F for ; Sun, 6 Mar 2022 13:51:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd33.google.com with SMTP id c23so14359127ioi.4 for ; Sun, 06 Mar 2022 04:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gPbR1X0aN/hwJEZwxwZOJKjlUlW7zpnLFqAlrietiJE=; b=GcyGd/+nLV9wwPbiS25Fkc3+KWgsa2kwNYbBoa0IdXRbi4sfSwBdTrFuPT/OfuV959 dWNmBKluszGKhwkhh081vujwshipVyhhXxDjXgmKK6UAVoR/GVrqhcyGqF01TeZMUUoK t1LAO4CIkk3CjfZELM2IgKtRcjSDqmkhN0+wM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gPbR1X0aN/hwJEZwxwZOJKjlUlW7zpnLFqAlrietiJE=; b=Pych+nUmFtEKvUVR6UM5DNjQ/tU6uI4vxEx2NTK1HBCH7MVNPf402mTEJphfFebSJq 7vwbhxPqt0++kprOcnZQZ1hzErjflNMREjoMoABmCUY/sprSaGbIQg4RdHNsvG+Nf4RU 6BAggWe68JN6KB7AAkEQDvDj/FXnIqu1sHPQeUpkm5vv+arR8/45PyMG7TY/rWIJg24h buqCv2/pNNscnczK9zB6QDjmzDkYwnGzRxXj3s4ZzYxDCzuirBlvv4EYxKdEypxj6y2T sDeFrSRfWcCB5E4m41ibQWdFKmbGI6lvGUuCzUjAApOsJpxj417LFT8N0x84lvBYxedQ iOeQ== X-Gm-Message-State: AOAM531oIHuz0+EGC0itttdMWnn+mKKwaQWgAi/6HNV/+nyqWZjFTnbr nG0WTo9+IQHxDp1pdjSQyXOkyt6mF2v3GA== X-Google-Smtp-Source: ABdhPJxl4Fup3ObBTBw3DdQSAcXFtufIcIU/w+rfCnIsnOZ34kw0P+VsY+GdK+OiYnnj8x59H/pvvg== X-Received: by 2002:a02:1d45:0:b0:317:c1ed:882f with SMTP id 66-20020a021d45000000b00317c1ed882fmr734786jaj.33.1646571059822; Sun, 06 Mar 2022 04:50:59 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id p22-20020a5d8d16000000b006115627b87csm7653533ioj.55.2022.03.06.04.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Mar 2022 04:50:59 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Dennis Gilmore , Ilias Apalodimas , Lukas Auer , Tom Rini , Heinrich Schuchardt , Michal Simek , Daniel Schwierzeck , Steffen Jaeckel , Simon Glass Subject: [PATCH v4 01/33] lib: Move string tests to the string module Date: Sun, 6 Mar 2022 05:49:44 -0700 Message-Id: <20220306125016.3133737-2-sjg@chromium.org> X-Mailer: git-send-email 2.35.1.616.g0bdcbb4464-goog In-Reply-To: <20220306125016.3133737-1-sjg@chromium.org> References: <20220306125016.3133737-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean A few string tests were added to the print module by mistake. Move them. Signed-off-by: Simon Glass --- Changes in v4: - Correct the commit tag test/print_ut.c | 40 ---------------------------------------- test/str_ut.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/test/print_ut.c b/test/print_ut.c index 247011f2db..47a6ce5784 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -345,26 +345,6 @@ static int print_do_hex_dump(struct unit_test_state *uts) } PRINT_TEST(print_do_hex_dump, UT_TESTF_CONSOLE_REC); -static int print_itoa(struct unit_test_state *uts) -{ - ut_asserteq_str("123", simple_itoa(123)); - ut_asserteq_str("0", simple_itoa(0)); - ut_asserteq_str("2147483647", simple_itoa(0x7fffffff)); - ut_asserteq_str("4294967295", simple_itoa(0xffffffff)); - - /* Use #ifdef here to avoid a compiler warning on 32-bit machines */ -#ifdef CONFIG_PHYS_64BIT - if (sizeof(ulong) == 8) { - ut_asserteq_str("9223372036854775807", - simple_itoa((1UL << 63) - 1)); - ut_asserteq_str("18446744073709551615", simple_itoa(-1)); - } -#endif /* CONFIG_PHYS_64BIT */ - - return 0; -} -PRINT_TEST(print_itoa, 0); - static int snprint(struct unit_test_state *uts) { char buf[10] = "xxxxxxxxx"; @@ -391,26 +371,6 @@ static int snprint(struct unit_test_state *uts) } PRINT_TEST(snprint, 0); -static int print_xtoa(struct unit_test_state *uts) -{ - ut_asserteq_str("7f", simple_xtoa(127)); - ut_asserteq_str("00", simple_xtoa(0)); - ut_asserteq_str("7fffffff", simple_xtoa(0x7fffffff)); - ut_asserteq_str("ffffffff", simple_xtoa(0xffffffff)); - - /* Use #ifdef here to avoid a compiler warning on 32-bit machines */ -#ifdef CONFIG_PHYS_64BIT - if (sizeof(ulong) == 8) { - ut_asserteq_str("7fffffffffffffff", - simple_xtoa((1UL << 63) - 1)); - ut_asserteq_str("ffffffffffffffff", simple_xtoa(-1)); - } -#endif /* CONFIG_PHYS_64BIT */ - - return 0; -} -PRINT_TEST(print_xtoa, 0); - int do_ut_print(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct unit_test *tests = UNIT_TEST_SUITE_START(print_test); diff --git a/test/str_ut.c b/test/str_ut.c index d2840d5152..6c817f6f72 100644 --- a/test/str_ut.c +++ b/test/str_ut.c @@ -202,6 +202,46 @@ static int str_dectoul(struct unit_test_state *uts) } STR_TEST(str_dectoul, 0); +static int str_itoa(struct unit_test_state *uts) +{ + ut_asserteq_str("123", simple_itoa(123)); + ut_asserteq_str("0", simple_itoa(0)); + ut_asserteq_str("2147483647", simple_itoa(0x7fffffff)); + ut_asserteq_str("4294967295", simple_itoa(0xffffffff)); + + /* Use #ifdef here to avoid a compiler warning on 32-bit machines */ +#ifdef CONFIG_PHYS_64BIT + if (sizeof(ulong) == 8) { + ut_asserteq_str("9223372036854775807", + simple_itoa((1UL << 63) - 1)); + ut_asserteq_str("18446744073709551615", simple_itoa(-1)); + } +#endif /* CONFIG_PHYS_64BIT */ + + return 0; +} +STR_TEST(str_itoa, 0); + +static int str_xtoa(struct unit_test_state *uts) +{ + ut_asserteq_str("7f", simple_xtoa(127)); + ut_asserteq_str("00", simple_xtoa(0)); + ut_asserteq_str("7fffffff", simple_xtoa(0x7fffffff)); + ut_asserteq_str("ffffffff", simple_xtoa(0xffffffff)); + + /* Use #ifdef here to avoid a compiler warning on 32-bit machines */ +#ifdef CONFIG_PHYS_64BIT + if (sizeof(ulong) == 8) { + ut_asserteq_str("7fffffffffffffff", + simple_xtoa((1UL << 63) - 1)); + ut_asserteq_str("ffffffffffffffff", simple_xtoa(-1)); + } +#endif /* CONFIG_PHYS_64BIT */ + + return 0; +} +STR_TEST(str_xtoa, 0); + int do_ut_str(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct unit_test *tests = UNIT_TEST_SUITE_START(str_test); -- 2.35.1.616.g0bdcbb4464-goog