diff options
author | Jacob Lee <artdent@gmail.com> | 2013-04-06 15:07:58 -0400 |
---|---|---|
committer | Jacob Lee <artdent@gmail.com> | 2013-04-06 15:14:52 -0400 |
commit | 66883355e44a2e671c997a7df2193b585be893d7 (patch) | |
tree | eff0633a09a11b93aff1e8306656c3903e7fb8a3 /tests | |
parent | 8408257cd66435af849f493c10c7f0e8d1d5fa3b (diff) |
scanf: support '*', which matches without assigning to an argument.
For example, sscanf("1 2 3", "%*d %d", &foo) stores 2 into foo.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index ef014a18..17b359a3 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -5743,6 +5743,24 @@ Pass: 0.000012 0.000012''') ''' self.do_run(src, '2, , black\n2, ., #001100\n2, X, #111100'); + def test_sscanf_skip(self): + src = r''' + #include <stdio.h> + + int main(){ + int val1; + printf("%d\n", sscanf("10 20 30 40", "%*lld %*d %d", &val1)); + printf("%d\n", val1); + + int64_t large, val2; + printf("%d\n", sscanf("1000000 -1125899906842620 -123 -1073741823", "%lld %*lld %ld %*d", &large, &val2)); + printf("%lld,%d\n", large, val2); + + return 0; + } + ''' + self.do_run(src, '1\n30\n2\n1000000,-123\n') + def test_langinfo(self): src = open(path_from_root('tests', 'langinfo', 'test.c'), 'r').read() expected = open(path_from_root('tests', 'langinfo', 'output.txt'), 'r').read() |