From patchwork Fri May 24 15:00:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1939007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=PqyuIEJV; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vm7XG70Hqz20Q0 for ; Sat, 25 May 2024 01:01:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 02AE738708C5 for ; Fri, 24 May 2024 15:01:00 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id D53C33858C48 for ; Fri, 24 May 2024 15:00:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D53C33858C48 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D53C33858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716562840; cv=none; b=OBzIfeElPVGDbZ0O4TJ+FcwWpg/LzMVemIw/hrt2yGIuiCPRZF3yC01pUIl77cuZq+kWdHtbf172OFBrXABhPwUjsYRbRdUNjBlwo5DaWY2SK9EwsiFL4wE9rml92KgFCxZrFL0SxAxvgpn5KLJlTlyHGZU/KF92BeQqVTwOu/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716562840; c=relaxed/simple; bh=AJ51A4o1xkNTkl4hnNJ1ak6buLuvjv9Nrb+caPkpwwQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SpPBl1HJ1X4TKkQ6QWlXzJ831Aw+gX6T8SXvBEoEkfdBJawvrYLAgEI0rHaEdWEwoR7HPVT28Y1qgzX3liqej2TTj0PlprbH6NGlbpgLpBFEnh6PE6enHhDCqny4iDkxyJTcnFKz4PFICCFs/Iy+mNZDxbVtYRcm8ZQXi2jwON8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1f3406f225bso14255435ad.3 for ; Fri, 24 May 2024 08:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716562837; x=1717167637; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=1SCB5yxw8TeZKAM48dCVUKBhJ2wMw4GEiwrwN63/4BQ=; b=PqyuIEJVmYCLROQiDrKP3x6Fyug65klxWwHm2LPx0vZBNSQH0/XMUFzn6Ql7TNiLHn 4s7ISxHVdIEk83Ftc0YunTQSzgnRbuVwLIALNf8GYi9w1r2kJ4FvNbOWe6ilzTOtWGvS l4RTqNpI6XKy1xZtgPfBePjYTqhTyDNnGH4eXKQa0Oj7Apj5MxwGzTYds8xIX6rGrhpV WGaI373jk3Gq1oC+dG3Wr94WKyCRo5fYrZGpcehwqXoE0clBQBPCp++ONS3UAya2yRcu z4GMoHwvwBD5AA0bQz1JMOzmU8aEaVRSXMoSoP9J3ONUbpP492xZsYUDbkgULx1ITv9B 4ZqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716562837; x=1717167637; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1SCB5yxw8TeZKAM48dCVUKBhJ2wMw4GEiwrwN63/4BQ=; b=rGP+fhvt/3AfViUMNvEnNVUV6IBolxV9mj/d2pkHOvyrlgabE/RTHltDhBacZ84Tkb A9TMp81wzN+gBsXSJK5soL2C+dR5MW5w+LtenrEm4DIjPrfSYcZlhLgbh1VMye/spCUu WnbcgFNNvVOFBJ3M52cenemWn9zcCQubBfZvasGNtxqbIa1xzGnNvDRKEioybOFCIJiP S8x+zDjQZ6c7N2P1R6ar0VgkPForB2Ib1rX9aYaqUEz0s6FwNk6+pFajhfQaSZ2WHAo6 RHXv1KDfLQw/yskxdHCcICM7E5MP2Pd7cJrtEGCvn5eEfcav4UPmWIm0Z2fq+CjF7Yvc eyjg== X-Gm-Message-State: AOJu0YzBOxbIkcbOzHB0Og6Sjrwa9N2RspPkrLNzB3TzPYC5vBU3P/gs mpm5ZBMdnt7U2fNYhF2Ggnqlqh6hE73EaYO0rwUMPexnJT1uIzGgD7I0iw== X-Google-Smtp-Source: AGHT+IEX66nLcTW0R7wF9Reu9WXb77//11rC3JvbpKdE3PZhh3SGavmhePcf8svssCFQVcOktJZjYg== X-Received: by 2002:a17:903:186:b0:1f3:3a05:1adf with SMTP id d9443c01a7336-1f4499092d7mr28804545ad.66.1716562836541; Fri, 24 May 2024 08:00:36 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.129.178]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f44c9e0984sm15198145ad.305.2024.05.24.08.00.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 08:00:36 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 041457405A7 for ; Fri, 24 May 2024 08:00:35 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH] Test fscanf of long double without Date: Fri, 24 May 2024 08:00:34 -0700 Message-ID: <20240524150034.2125782-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3022.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Add a test for fscanf of long double without including . Signed-off-by: H.J. Lu Reviewed-by: Sunil K Pandey --- stdio-common/Makefile | 1 + stdio-common/test-fscanf.c | 37 ++++++++++++++++++++++++++++++++++ stdio-common/test-fscanf.input | 1 + 3 files changed, 39 insertions(+) create mode 100644 stdio-common/test-fscanf.c create mode 100644 stdio-common/test-fscanf.input diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 6bc972af1a..274bece0a2 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -193,6 +193,7 @@ tests := \ scanf18 \ scanf19 \ temptest \ + test-fscanf \ test-fseek \ test-fwrite \ test-popen \ diff --git a/stdio-common/test-fscanf.c b/stdio-common/test-fscanf.c new file mode 100644 index 0000000000..f2c4250b51 --- /dev/null +++ b/stdio-common/test-fscanf.c @@ -0,0 +1,37 @@ +/* Test fscanf of long double without . + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +struct FILE; +extern struct FILE *stdin; +extern int fscanf (struct FILE *, const char *, ...); + +int +main (void) +{ + int n, i; + long double x; + char name[50]; + n = fscanf (stdin, "%d%Lf%s", &i, &x, name); + + if (n != 3 || i != 25 || x != 24.5 || strcmp (name, "thompson")) + return 1; + + return 0; +} diff --git a/stdio-common/test-fscanf.input b/stdio-common/test-fscanf.input new file mode 100644 index 0000000000..69322cc51a --- /dev/null +++ b/stdio-common/test-fscanf.input @@ -0,0 +1 @@ +25 24.5 thompson