summaryrefslogtreecommitdiff
path: root/test/test_fmt_sscanf.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-11 00:46:52 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-11 00:46:52 +0200
commit62eebd19dfd71a16df670590d0c61fbd50f18d24 (patch)
tree11e899fa69c73ab5e80a164bd9827fc8cebd7691 /test/test_fmt_sscanf.c
parent77a2a8ad9c3590e04b49cdd64b5e5a342afa1d60 (diff)
fmt: fix 0 and octal integer parsing
Diffstat (limited to 'test/test_fmt_sscanf.c')
-rw-r--r--test/test_fmt_sscanf.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_fmt_sscanf.c b/test/test_fmt_sscanf.c
index b2a4e74..8abab69 100644
--- a/test/test_fmt_sscanf.c
+++ b/test/test_fmt_sscanf.c
@@ -677,6 +677,38 @@ test_38(void)
#undef STRING
}
+static void
+test_39(void)
+{
+ int reta, retb;
+ unsigned int ia, ib;
+
+#define STRING "0"
+#define FORMAT "%u"
+ reta = sscanf(STRING, FORMAT, &ia);
+ retb = fmt_sscanf(STRING, FORMAT, &ib);
+ check(reta == retb);
+ check(ia == ib);
+#undef FORMAT
+#undef STRING
+}
+
+static void
+test_40(void)
+{
+ int reta, retb;
+ int ia, ib;
+
+#define STRING "-0"
+#define FORMAT "%d"
+ reta = sscanf(STRING, FORMAT, &ia);
+ retb = fmt_sscanf(STRING, FORMAT, &ib);
+ check(reta == retb);
+ check(ia == ib);
+#undef FORMAT
+#undef STRING
+}
+
int
main(int argc, char *argv[])
{
@@ -721,6 +753,8 @@ main(int argc, char *argv[])
test_36();
test_37();
test_38();
+ test_39();
+ test_40();
return 0;
}