aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanuels <manuel.schoelling@gmx.de>2013-01-19 14:40:43 +0100
committermanuels <manuel.schoelling@gmx.de>2013-01-19 14:40:43 +0100
commitafc8e0cc820f9e2fe952e7113ab15f1296b7da84 (patch)
treefcec195e889b131e9c868279f499da17ba39909f
parentf9d8e493760b1b1720a45133896fb690919b3c6d (diff)
Add testcase for sscanf floating point format aliases
-rw-r--r--AUTHORS1
-rwxr-xr-xtests/runner.py20
2 files changed, 14 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index 04dfc10d..9a0fa20d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -44,4 +44,5 @@ a license to everyone to use it as detailed in LICENSE.)
* Dominic Wong <dom@slowbunyip.org>
* Alan Kligman <alan.kligman@gmail.com> (copyright owned by Mozilla Foundation)
* Anthony Liot <wolfviking0@yahoo.com>
+* Manuel Schölling <manuel.schoelling@gmx.de>
diff --git a/tests/runner.py b/tests/runner.py
index 7c0edcbe..106389a9 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4864,13 +4864,19 @@ at function.:blag
printf("%f, %f\n", atof("1.234567"), atof("cheez"));
- float n = -1;
- sscanf(" 2.8208", "%f", &n);
- printf("%.4f\n", n);
+ char float_formats[] = "fegE";
+ char format[] = "%_";
+ for(int i = 0; i < 4; ++i) {
+ format[1] = float_formats[i];
- float a = -1;
- sscanf("-3.03", "%f", &a);
- printf("%.4f\n", a);
+ float n = -1;
+ sscanf(" 2.8208", format, &n);
+ printf("%.4f\n", n);
+
+ float a = -1;
+ sscanf("-3.03", format, &a);
+ printf("%.4f\n", a);
+ }
char buffy[100];
sscanf("cheez some thing moar 123\nyet more\n", "cheez %s", buffy);
@@ -4903,7 +4909,7 @@ at function.:blag
return 0;
}
'''
- self.do_run(src, 'en-us : 2\nen-r : 99\nen : 3\n1.234567, 0.000000\n2.8208\n-3.0300\n|some|\n|something|\n|somethingmoar|\n' +
+ self.do_run(src, 'en-us : 2\nen-r : 99\nen : 3\n1.234567, 0.000000\n2.8208\n-3.0300\n2.8208\n-3.0300\n2.8208\n-3.0300\n2.8208\n-3.0300\n|some|\n|something|\n|somethingmoar|\n' +
'1\n1499\n' +
'5\n87,0.481565,0.059481,0,1\n' +
'3\n-123,4294966531,-34\n' +