[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2289] New tests added, for bug #35366.
From: |
Dmitry Xmelkov |
Subject: |
[avr-libc-commit] [2289] New tests added, for bug #35366. |
Date: |
Sat, 28 Jan 2012 01:31:49 +0000 |
Revision: 2289
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2289
Author: dmix
Date: 2012-01-28 01:31:48 +0000 (Sat, 28 Jan 2012)
Log Message:
-----------
New tests added, for bug #35366. Seems, there is no bug.
tests/simulate/regression/bug-35366-1-printf_flt.c: New file.
tests/simulate/regression/bug-35366-2-printf_flt.c: New file.
Ticket Links:
------------
http://savannah.gnu.org/bugs/?35366
Modified Paths:
--------------
trunk/avr-libc/ChangeLog
Added Paths:
-----------
trunk/avr-libc/tests/simulate/regression/bug-35366-1-printf_flt.c
trunk/avr-libc/tests/simulate/regression/bug-35366-2-printf_flt.c
Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog 2012-01-15 13:20:01 UTC (rev 2288)
+++ trunk/avr-libc/ChangeLog 2012-01-28 01:31:48 UTC (rev 2289)
@@ -1,3 +1,8 @@
+2012-01-28 Dmitry Xmelkov <address@hidden>
+
+ * tests/simulate/regression/bug-35366-1-printf_flt.c: New file.
+ * tests/simulate/regression/bug-35366-2-printf_flt.c: New file.
+
2012-01-15 Dmitry Xmelkov <address@hidden>
Fix for bug #35197: sleep.h _BV defined as __BV in AT90S8515 section
Added: trunk/avr-libc/tests/simulate/regression/bug-35366-1-printf_flt.c
===================================================================
--- trunk/avr-libc/tests/simulate/regression/bug-35366-1-printf_flt.c
(rev 0)
+++ trunk/avr-libc/tests/simulate/regression/bug-35366-1-printf_flt.c
2012-01-28 01:31:48 UTC (rev 2289)
@@ -0,0 +1,84 @@
+/* Copyright (c) 2012 Dmitry Xmelkov
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* bug #35366: Bad behaviour for fprintf_P function
+ Seems, there is no bug.
+ $Id$ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifndef __AVR__
+
+/* Skip testing. */
+int main () { return 0; }
+
+#else
+# include <avr/pgmspace.h>
+# define PUTS(s)
+
+static char s[50]; /* buffer for result */
+
+static int put (char c, FILE *fp)
+{
+ (void)fp;
+ size_t n = strlen (s);
+ if (n < sizeof (s) - 1)
+ s[n] = c;
+ return c;
+}
+
+static FILE outfile = FDEV_SETUP_STREAM (put, 0, _FDEV_SETUP_WRITE);
+
+int main ()
+{
+ FILE *out;
+
+ out = &outfile;
+
+ fprintf_P (out, PSTR ("e1=%f %% e2=%f"), 0.5, -1.125);
+ fflush (out);
+ if (strcmp (s, "e1=0.500000 % e2=-1.125000")) {
+ PUTS (s);
+ return __LINE__;
+ }
+
+ memset (s, 0, sizeof (s));
+
+ fprintf_P (out, PSTR ("e1=%f %%%% e2=%f"), -123.0, 9876.5);
+ fflush (out);
+ if (strcmp (s, "e1=-123.000000 %% e2=9876.500000")) {
+ PUTS (s);
+ return __LINE__;
+ }
+
+ return 0;
+}
+#endif /* __AVR__ */
Property changes on:
trunk/avr-libc/tests/simulate/regression/bug-35366-1-printf_flt.c
___________________________________________________________________
Added: svn:keywords
+ Author Id Date
Added: trunk/avr-libc/tests/simulate/regression/bug-35366-2-printf_flt.c
===================================================================
--- trunk/avr-libc/tests/simulate/regression/bug-35366-2-printf_flt.c
(rev 0)
+++ trunk/avr-libc/tests/simulate/regression/bug-35366-2-printf_flt.c
2012-01-28 01:31:48 UTC (rev 2289)
@@ -0,0 +1,70 @@
+/* Copyright (c) 2012 Dmitry Xmelkov
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* bug #35366: Bad behaviour for fprintf_P function
+ Seems, there is no bug.
+ $Id$ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef __AVR__
+# include <avr/pgmspace.h>
+# define PUTS(s)
+#else
+# define PUTS(s) puts (s)
+#endif
+
+void foo (char *s, size_t n, const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ vsnprintf (s, n, fmt, ap);
+ va_end (ap);
+}
+
+int main ()
+{
+ char s[50] = "";
+
+ foo (s, sizeof (s), "e1=%f %% e2=%f", 1.25, -6.5);
+ if (strcmp (s, "e1=1.250000 % e2=-6.500000")) {
+ PUTS (s);
+ return __LINE__;
+ }
+
+ foo (s, sizeof (s), "e1=%f %%%% e2=%f", -321.0, 0.125);
+ if (strcmp (s, "e1=-321.000000 %% e2=0.125000")) {
+ PUTS (s);
+ return __LINE__;
+ }
+
+ return 0;
+}
Property changes on:
trunk/avr-libc/tests/simulate/regression/bug-35366-2-printf_flt.c
___________________________________________________________________
Added: svn:keywords
+ Author Id Date
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2289] New tests added, for bug #35366.,
Dmitry Xmelkov <=