diff options
author | Richard Braun <rbraun@sceen.net> | 2017-06-23 23:15:11 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-06-23 23:15:11 +0200 |
commit | 24ae3a1e9ab000b85414227da5b897f89aaa030d (patch) | |
tree | e38315cb1d458aeacb21da2cfb97f0e16a7c6e4c /test | |
parent | 88517e5a05f2fbced6c5ac603872f39069db0a15 (diff) |
fmt: fix character conversion reporting
Diffstat (limited to 'test')
-rw-r--r-- | test/test_fmt_sscanf.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test_fmt_sscanf.c b/test/test_fmt_sscanf.c index cc0d018..55150df 100644 --- a/test/test_fmt_sscanf.c +++ b/test/test_fmt_sscanf.c @@ -709,6 +709,40 @@ test_40(void) #undef STRING } +static void +test_41(void) +{ + int reta, retb; + unsigned int ia, ib; + char ja, jb; + unsigned int ka, kb; + +#define STRING "34800" +#define FORMAT "%u%c%1u" + reta = sscanf(STRING, FORMAT, &ia, &ja, &ka); + retb = fmt_sscanf(STRING, FORMAT, &ib, &jb, &kb); + check(reta == retb); + check(ia == ib); +#undef FORMAT +#undef STRING +} + +static void +test_42(void) +{ + int reta, retb; + char ia, ib; + +#define STRING "abc" +#define FORMAT "%0c" + 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[]) { @@ -755,6 +789,8 @@ main(int argc, char *argv[]) test_38(); test_39(); test_40(); + test_41(); + test_42(); return 0; } |