Add a printf regression test; for now covering lib/32951.
This commit is contained in:
parent
11ef0797ab
commit
ff12504c9c
@ -1,5 +1,5 @@
|
||||
# $NetBSD: Makefile,v 1.1 2003/05/30 12:46:05 simonb Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2006/02/28 19:30:45 kleink Exp $
|
||||
|
||||
SUBDIR+= scanf
|
||||
SUBDIR+= printf scanf
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
11
regress/lib/libc/stdio/printf/Makefile
Normal file
11
regress/lib/libc/stdio/printf/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $NetBSD: Makefile,v 1.1 2006/02/28 19:30:45 kleink Exp $
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
PROG= printf
|
||||
WARNS?= 4
|
||||
|
||||
regress: ${PROG}
|
||||
./${PROG}
|
||||
|
||||
.include <bsd.prog.mk>
|
22
regress/lib/libc/stdio/printf/printf.c
Normal file
22
regress/lib/libc/stdio/printf/printf.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* $NetBSD: printf.c,v 1.1 2006/02/28 19:30:45 kleink Exp $ */
|
||||
|
||||
/*
|
||||
* Written by Klaus Klein <kleink@NetBSD.org>, February 28, 2006.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char s[2];
|
||||
|
||||
/* PR lib/32951: %.0f formats (0.0,0.5] to "0." */
|
||||
assert(snprintf(s, sizeof(s), "%.0f", 0.1) == 1);
|
||||
assert(s[0] == '0');
|
||||
/* assert(s[1] == '\0'); */
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user