diff options
-rw-r--r-- | tests/core/test_printf_more.in | 13 | ||||
-rw-r--r-- | tests/core/test_printf_more.out | 2 | ||||
-rw-r--r-- | tests/test_core.py | 18 |
3 files changed, 19 insertions, 14 deletions
diff --git a/tests/core/test_printf_more.in b/tests/core/test_printf_more.in new file mode 100644 index 00000000..b8e3ba61 --- /dev/null +++ b/tests/core/test_printf_more.in @@ -0,0 +1,13 @@ + + #include <stdio.h> + int main() { + int size = snprintf(NULL, 0, "%s %d %.2f\n", "me and myself", 25, 1.345); + char buf[size]; + snprintf(buf, size, "%s %d %.2f\n", "me and myself", 25, 1.345); + printf("%d : %s\n", size, buf); + char *buff = NULL; + asprintf(&buff, "%d waka %d\n", 21, 95); + puts(buff); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_printf_more.out b/tests/core/test_printf_more.out new file mode 100644 index 00000000..e31f1d50 --- /dev/null +++ b/tests/core/test_printf_more.out @@ -0,0 +1,2 @@ +22 : me and myself 25 1.34 +21 waka 95 diff --git a/tests/test_core.py b/tests/test_core.py index 5b8976b7..20d79a47 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -3608,20 +3608,10 @@ ok self.do_run_from_file(src, output) def test_printf_more(self): - src = r''' - #include <stdio.h> - int main() { - int size = snprintf(NULL, 0, "%s %d %.2f\n", "me and myself", 25, 1.345); - char buf[size]; - snprintf(buf, size, "%s %d %.2f\n", "me and myself", 25, 1.345); - printf("%d : %s\n", size, buf); - char *buff = NULL; - asprintf(&buff, "%d waka %d\n", 21, 95); - puts(buff); - return 0; - } - ''' - self.do_run(src, '22 : me and myself 25 1.34\n21 waka 95\n') + test_path = path_from_root('tests', 'core', 'test_printf_more') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) def test_perrar(self): src = r''' |