From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1039) id 0AA193858D29; Fri, 24 May 2024 17:26:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AA193858D29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1716571618; bh=KkhOqwz3NSeeTXwSDmEO88XwoiD8fSz8fwt6k83YERI=; h=From:To:Subject:Date:From; b=lbuTWa803nRNIc/vRMARwLxBTM5lhc2YPcHPFLlY4CMfnIhxgPJmyaVfic11rhq3z dZiRwkPfJG/EiGeycchbdcmm/3A1o3U2XiDD2d6lXd+oE8GelioBofGnzJPc5TZB6c E9sMWHzqlYVqWe/qPjr08f2x/q8OoyJCXPbzlNEU= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: H.J. Lu To: glibc-cvs@sourceware.org Subject: [glibc] Test fscanf of long double without X-Act-Checkin: glibc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: 639c143db3fcf6ec1537b86946233c0bc3b03d6e X-Git-Newrev: 30a745450e01e4c6f484dc691c16a54a6ea72288 Message-Id: <20240524172658.0AA193858D29@sourceware.org> Date: Fri, 24 May 2024 17:26:57 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=30a745450e01e4c6f484dc691c16a54a6ea72288 commit 30a745450e01e4c6f484dc691c16a54a6ea72288 Author: H.J. Lu Date: Fri May 24 08:00:34 2024 -0700 Test fscanf of long double without Add a test for fscanf of long double without including . Signed-off-by: H.J. Lu Reviewed-by: Sunil K Pandey Diff: --- stdio-common/Makefile | 1 + stdio-common/test-fscanf.c | 37 +++++++++++++++++++++++++++++++++++++ stdio-common/test-fscanf.input | 1 + 3 files changed, 39 insertions(+) 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