aboutsummaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 15:40:55 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:59 +0200
commitcc6043603f427d24a00b567a01908cd220890ecd (patch)
treee7f72cd975363070b782359c8df07c0d81668e4d /tests/core
parent4ca97d11ef6312c55b40c6a472adbb6f89eb09db (diff)
Use do_run_from_file() for test_sscanf_n
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/test_sscanf_n.in21
-rw-r--r--tests/core/test_sscanf_n.out3
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/core/test_sscanf_n.in b/tests/core/test_sscanf_n.in
new file mode 100644
index 00000000..78142b3a
--- /dev/null
+++ b/tests/core/test_sscanf_n.in
@@ -0,0 +1,21 @@
+
+ #include<stdio.h>
+ int main() {
+ char *line = "version 1.0";
+ int i, l, lineno;
+ char word[80];
+ if (sscanf(line, "%s%n", word, &l) != 1) {
+ printf("Header format error, line %d\n", lineno);
+ }
+ printf("[DEBUG] word 1: %s, l: %d\n", word, l);
+
+ int x = sscanf("one %n two", "%s %n", word, &l);
+ printf("%d,%s,%d\n", x, word, l);
+ {
+ int a, b, c, count;
+ count = sscanf("12345 6789", "%d %n%d", &a, &b, &c);
+ printf("%i %i %i %i\n", count, a, b, c);
+ }
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_sscanf_n.out b/tests/core/test_sscanf_n.out
new file mode 100644
index 00000000..c3ce6f04
--- /dev/null
+++ b/tests/core/test_sscanf_n.out
@@ -0,0 +1,3 @@
+[DEBUG] word 1: version, l: 7
+1,one,4
+2 12345 6 6789