t_gdtoa.c revision 272343
11573Srgrimes/*- 21573Srgrimes * Copyright (c) 2009 The NetBSD Foundation, Inc. 31573Srgrimes * All rights reserved. 41573Srgrimes * 51573Srgrimes * This code is derived from software contributed to The NetBSD Foundation 61573Srgrimes * by Christos Zoulas. 71573Srgrimes * 81573Srgrimes * Redistribution and use in source and binary forms, with or without 91573Srgrimes * modification, are permitted provided that the following conditions 101573Srgrimes * are met: 111573Srgrimes * 1. Redistributions of source code must retain the above copyright 121573Srgrimes * notice, this list of conditions and the following disclaimer. 131573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141573Srgrimes * notice, this list of conditions and the following disclaimer in the 151573Srgrimes * documentation and/or other materials provided with the distribution. 161573Srgrimes * 3. All advertising materials mentioning features or use of this software 171573Srgrimes * must display the following acknowledgement: 181573Srgrimes * This product includes software developed by the NetBSD 191573Srgrimes * Foundation, Inc. and its contributors. 201573Srgrimes * 4. Neither the name of The NetBSD Foundation nor the names of its 211573Srgrimes * contributors may be used to endorse or promote products derived 221573Srgrimes * from this software without specific prior written permission. 231573Srgrimes * 241573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 251573Srgrimes * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 261573Srgrimes * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 271573Srgrimes * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 281573Srgrimes * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 291573Srgrimes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3083551Sdillon * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3183551Sdillon * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3283551Sdillon * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 331573Srgrimes * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3455127Speter * POSSIBILITY OF SUCH DAMAGE. 351573Srgrimes */ 3655127Speter#include <sys/cdefs.h> 371573Srgrimes__RCSID("$NetBSD: t_gdtoa.c,v 1.4 2012/09/27 08:19:18 martin Exp $"); 381573Srgrimes 391573Srgrimes#include <atf-c.h> 408870Srgrimes 411573Srgrimes#include <stdio.h> 421573Srgrimes#include <stdlib.h> 431573Srgrimes 441573Srgrimes/* reported by Maksymilian Arciemowicz */ 451573Srgrimes 461573SrgrimesATF_TC(long_format); 471573Srgrimes 481573SrgrimesATF_TC_HEAD(long_format, tc) 49179320Spjd{ 501573Srgrimes 511573Srgrimes atf_tc_set_md_var(tc, "descr", "Test printf with %%1.262159f format"); 521573Srgrimes} 531573Srgrimes 541573SrgrimesATF_TC_BODY(long_format, tc) 551573Srgrimes{ 561573Srgrimes char *buf; 571573Srgrimes ATF_REQUIRE_EQ(262161, asprintf(&buf, "%1.262159f", 1.1)); 581573Srgrimes free(buf); 591573Srgrimes} 601573Srgrimes 611573SrgrimesATF_TP_ADD_TCS(tp) 621573Srgrimes{ 631573Srgrimes 64194186Sed ATF_TP_ADD_TC(tp, long_format); 651573Srgrimes 661573Srgrimes return atf_no_error(); 671573Srgrimes} 681573Srgrimes