diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 15:46:14 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:00 +0200 |
commit | 8102a3ef09cf1cc174ce232690e1d7ba500c2bf0 (patch) | |
tree | 913bf07a23e14cf223f237858bb8ea3aa3b1900c /tests | |
parent | dff0b829dd8e624942eef87385ddbe72b3695e8e (diff) |
Use do_run_from_file() for test_sscanf_5
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_sscanf_5.in | 19 | ||||
-rw-r--r-- | tests/core/test_sscanf_5.out | 3 | ||||
-rw-r--r-- | tests/test_core.py | 22 |
3 files changed, 25 insertions, 19 deletions
diff --git a/tests/core/test_sscanf_5.in b/tests/core/test_sscanf_5.in new file mode 100644 index 00000000..c3c1ed8a --- /dev/null +++ b/tests/core/test_sscanf_5.in @@ -0,0 +1,19 @@ + + #include "stdio.h" + + static const char *colors[] = { + " c black", + ". c #001100", + "X c #111100" + }; + + int main(){ + unsigned char code; + char color[32]; + int rcode; + for(int i = 0; i < 3; i++) { + rcode = sscanf(colors[i], "%c c %s", &code, color); + printf("%i, %c, %s\n", rcode, code, color); + } + } +
\ No newline at end of file diff --git a/tests/core/test_sscanf_5.out b/tests/core/test_sscanf_5.out new file mode 100644 index 00000000..823ae41f --- /dev/null +++ b/tests/core/test_sscanf_5.out @@ -0,0 +1,3 @@ +2, , black +2, ., #001100 +2, X, #111100
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 2b9a1f42..07979758 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -3733,26 +3733,10 @@ Pass: 0.000012 0.000012''') self.do_run_from_file(src, output) def test_sscanf_5(self): - src = r''' - #include "stdio.h" - - static const char *colors[] = { - " c black", - ". c #001100", - "X c #111100" - }; + test_path = path_from_root('tests', 'core', 'test_sscanf_5') + src, output = (test_path + s for s in ('.in', '.out')) - int main(){ - unsigned char code; - char color[32]; - int rcode; - for(int i = 0; i < 3; i++) { - rcode = sscanf(colors[i], "%c c %s", &code, color); - printf("%i, %c, %s\n", rcode, code, color); - } - } - ''' - self.do_run(src, '2, , black\n2, ., #001100\n2, X, #111100'); + self.do_run_from_file(src, output) def test_sscanf_6(self): src = r''' |