aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 15:41:57 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:59 +0200
commit884a6e928ae568a04246bff5269a988d436624d6 (patch)
treeec41d73d3f22e4eb0cd558180ab69545502cc7de /tests
parentcc6043603f427d24a00b567a01908cd220890ecd (diff)
Use do_run_from_file() for test_sscanf_whitespace
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_sscanf_whitespace.in23
-rw-r--r--tests/core/test_sscanf_whitespace.out1
-rw-r--r--tests/test_core.py26
3 files changed, 27 insertions, 23 deletions
diff --git a/tests/core/test_sscanf_whitespace.in b/tests/core/test_sscanf_whitespace.in
new file mode 100644
index 00000000..6947203f
--- /dev/null
+++ b/tests/core/test_sscanf_whitespace.in
@@ -0,0 +1,23 @@
+
+ #include<stdio.h>
+
+ int main() {
+ short int x;
+ short int y;
+
+ const char* buffer[] = {
+ "173,16",
+ " 16,173",
+ "183, 173",
+ " 17, 287",
+ " 98, 123, "
+ };
+
+ for (int i=0; i<5; ++i) {
+ sscanf(buffer[i], "%hd,%hd", &x, &y);
+ printf("%d:%d,%d ", i, x, y);
+ }
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_sscanf_whitespace.out b/tests/core/test_sscanf_whitespace.out
new file mode 100644
index 00000000..9a26dd1d
--- /dev/null
+++ b/tests/core/test_sscanf_whitespace.out
@@ -0,0 +1 @@
+0:173,16 1:16,173 2:183,173 3:17,287 4:98,123 \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 6f1f9b31..ae891355 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3704,30 +3704,10 @@ Pass: 0.000012 0.000012''')
self.do_run_from_file(src, output)
def test_sscanf_whitespace(self):
- src = r'''
- #include<stdio.h>
-
- int main() {
- short int x;
- short int y;
-
- const char* buffer[] = {
- "173,16",
- " 16,173",
- "183, 173",
- " 17, 287",
- " 98, 123, "
- };
-
- for (int i=0; i<5; ++i) {
- sscanf(buffer[i], "%hd,%hd", &x, &y);
- printf("%d:%d,%d ", i, x, y);
- }
+ test_path = path_from_root('tests', 'core', 'test_sscanf_whitespace')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 0;
- }
- '''
- self.do_run(src, '''0:173,16 1:16,173 2:183,173 3:17,287 4:98,123''')
+ self.do_run_from_file(src, output)
def test_sscanf_other_whitespace(self):
Settings.SAFE_HEAP = 0 # use i16s in printf