aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 15:43:01 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:00 +0200
commit71020af95b4173a0878adb99b0a27ca5adc2ceb6 (patch)
treefa14d8e4ef2c9cefd7fe495c7d5d92497650a8db
parent884a6e928ae568a04246bff5269a988d436624d6 (diff)
Use do_run_from_file() for test_sscanf_other_whitespace
-rw-r--r--tests/core/test_sscanf_other_whitespace.in29
-rw-r--r--tests/core/test_sscanf_other_whitespace.out1
-rw-r--r--tests/test_core.py32
3 files changed, 33 insertions, 29 deletions
diff --git a/tests/core/test_sscanf_other_whitespace.in b/tests/core/test_sscanf_other_whitespace.in
new file mode 100644
index 00000000..224d1a23
--- /dev/null
+++ b/tests/core/test_sscanf_other_whitespace.in
@@ -0,0 +1,29 @@
+
+ #include<stdio.h>
+
+ int main() {
+ short int x;
+ short int y;
+
+ const char* buffer[] = {
+ "\t2\t3\t", /* TAB - horizontal tab */
+ "\t\t5\t\t7\t\t",
+ "\n11\n13\n", /* LF - line feed */
+ "\n\n17\n\n19\n\n",
+ "\v23\v29\v", /* VT - vertical tab */
+ "\v\v31\v\v37\v\v",
+ "\f41\f43\f", /* FF - form feed */
+ "\f\f47\f\f53\f\f",
+ "\r59\r61\r", /* CR - carrage return */
+ "\r\r67\r\r71\r\r"
+ };
+
+ for (int i=0; i<10; ++i) {
+ x = 0; y = 0;
+ sscanf(buffer[i], " %d %d ", &x, &y);
+ printf("%d, %d, ", x, y);
+ }
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_sscanf_other_whitespace.out b/tests/core/test_sscanf_other_whitespace.out
new file mode 100644
index 00000000..0d0f4beb
--- /dev/null
+++ b/tests/core/test_sscanf_other_whitespace.out
@@ -0,0 +1 @@
+2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index ae891355..c2faf81d 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3712,36 +3712,10 @@ Pass: 0.000012 0.000012''')
def test_sscanf_other_whitespace(self):
Settings.SAFE_HEAP = 0 # use i16s in printf
- src = r'''
- #include<stdio.h>
-
- int main() {
- short int x;
- short int y;
-
- const char* buffer[] = {
- "\t2\t3\t", /* TAB - horizontal tab */
- "\t\t5\t\t7\t\t",
- "\n11\n13\n", /* LF - line feed */
- "\n\n17\n\n19\n\n",
- "\v23\v29\v", /* VT - vertical tab */
- "\v\v31\v\v37\v\v",
- "\f41\f43\f", /* FF - form feed */
- "\f\f47\f\f53\f\f",
- "\r59\r61\r", /* CR - carrage return */
- "\r\r67\r\r71\r\r"
- };
-
- for (int i=0; i<10; ++i) {
- x = 0; y = 0;
- sscanf(buffer[i], " %d %d ", &x, &y);
- printf("%d, %d, ", x, y);
- }
+ test_path = path_from_root('tests', 'core', 'test_sscanf_other_whitespace')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 0;
- }
- '''
- self.do_run(src, '''2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ''')
+ self.do_run_from_file(src, output)
def test_sscanf_3(self):
# i64