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 9C723C433F5 for ; Mon, 25 Apr 2022 05:32:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E391083E15; Mon, 25 Apr 2022 07:32:12 +0200 (CEST) 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="Mcc95S1x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C808B83DF3; Mon, 25 Apr 2022 07:32:09 +0200 (CEST) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 AC4E383D86 for ; Mon, 25 Apr 2022 07:32:06 +0200 (CEST) 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-ej1-x631.google.com with SMTP id w16so6171219ejb.13 for ; Sun, 24 Apr 2022 22:32:06 -0700 (PDT) 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=5wVSOtRiywLQf/r2bwJct2xgtj9K/nrdz+aEmKb5Ix8=; b=Mcc95S1x1aB2Gi8xrRxfITqV9Xk88i/BLF2HhYjQyb0buA5YO2fpDhltUEmfeNJfvq IU+iSFJ/tlaGzz2TvvrwrSqhMVwgvjaqk1dKaVj/ySy9SjvOhW9KjtubEr3PTcWZChOR qNMCU3DyMUqAn2hrl5X9+g+shnQ+bXI31rcIE= 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=5wVSOtRiywLQf/r2bwJct2xgtj9K/nrdz+aEmKb5Ix8=; b=FWPigpE4EngIS6enfdBvHXxDbT4h0wRNYu02UzXS4z2LSVZfS2tOlt8jKpPz+rdbad jRHlmmyhTvYxPJEE5DXsD5sD/eRvi4nS0Ms9atP5FQJU9E8N89Asas0Ye0dPDHik7Ipu SMpBIw/VZNQndI4a1gVpqurHp8gJJLgmmO+w3x+0k8x6t9ic0Qi0N0VELLo2u1C4oLGY 0rjLwvm+lnuVGYg2g3dQ10QPH+hOv/Od5oxQ4ExOSslMrZd0DrZzXoua0YKNOXzeoDrj kPeaxqjU6/ljh86O7u9XjsHSlt6Vu9QEW3LHgVJBe7zOSSIdTn3He5QBB+M9aSsdBxxO TBsQ== X-Gm-Message-State: AOAM530cJ2gHFX+DNFFH+VZ9esE+64t4KHlNMo40n36Bl/WS4I8HNxWE /duAc4XZuw2BNGdTWzLqY3OkEWFbdfTGQJgJ X-Google-Smtp-Source: ABdhPJy62twpxu7NW4uidX6w/rlgQbdFR2l//ycOwXxx4RoobRTWUZ6neAPMDn+LrtHo8/A+ryqfFQ== X-Received: by 2002:a17:906:8585:b0:6f3:99f0:d061 with SMTP id v5-20020a170906858500b006f399f0d061mr2041160ejx.436.1650864726048; Sun, 24 Apr 2022 22:32:06 -0700 (PDT) Received: from sjg1.c.hospitality.swisscom.com (d54c768e3.static.telenet.be. [84.199.104.227]) by smtp.gmail.com with ESMTPSA id s12-20020a1709062ecc00b006e8558c9a5csm3230784eji.94.2022.04.24.22.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 22:32:05 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Dennis Gilmore , Lukas Auer , Daniel Schwierzeck , Tom Rini , Michal Simek , Ilias Apalodimas , Steffen Jaeckel , Simon Glass Subject: [PATCH v5 01/34] lib: Move string tests to the string module Date: Sun, 24 Apr 2022 23:30:54 -0600 Message-Id: <20220425053127.19950-2-sjg@chromium.org> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog In-Reply-To: <20220425053127.19950-1-sjg@chromium.org> References: <20220425053127.19950-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 --- (no changes since v4) 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 247011f2db0..47a6ce57840 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 d2840d51524..6c817f6f72f 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.36.0.rc2.479.g8af0fa9b8e-goog