diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_wprintf.c | 15 | ||||
-rw-r--r-- | tests/core/test_wprintf.out | 8 | ||||
-rw-r--r-- | tests/test_core.py | 6 |
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/core/test_wprintf.c b/tests/core/test_wprintf.c new file mode 100644 index 00000000..e938bf69 --- /dev/null +++ b/tests/core/test_wprintf.c @@ -0,0 +1,15 @@ +#include <wchar.h> + +int main() +{ + wprintf (L"Characters: %lc %lc \n", L'a', 65); + wprintf (L"Decimals: %d %ld\n", 1977, 650000L); + wprintf (L"Preceding with blanks: %10d \n", 1977); + wprintf (L"Preceding with zeros: %010d \n", 1977); + wprintf (L"Some different radixes: %d %x %o %#x %#o \n", 100, 100, 100, 100, 100); + wprintf (L"floats: %4.2f %+.0e %E \n", 3.1416, 3.1416, 3.1416); + wprintf (L"Width trick: %*d \n", 5, 10); + wprintf (L"%ls \n", L"A wide string"); + return 0; +} + diff --git a/tests/core/test_wprintf.out b/tests/core/test_wprintf.out new file mode 100644 index 00000000..f85abebb --- /dev/null +++ b/tests/core/test_wprintf.out @@ -0,0 +1,8 @@ +Characters: a A +Decimals: 1977 650000 +Preceding with blanks: 1977 +Preceding with zeros: 0000001977 +Some different radixes: 100 64 144 0x64 0144 +floats: 3.14 +3e+00 3.141600E+00 +Width trick: 10 +A wide string diff --git a/tests/test_core.py b/tests/test_core.py index c89e785e..d7bebdc6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4090,6 +4090,12 @@ def process(filename): self.do_run(open(path_from_root('tests', 'utf32.cpp')).read(), 'OK.') self.do_run(open(path_from_root('tests', 'utf32.cpp')).read(), 'OK.', args=['-fshort-wchar']) + def test_wprintf(self): + if self.emcc_args is None: return self.skip('requires libcxx') + test_path = path_from_root('tests', 'core', 'test_wprintf') + src, output = (test_path + s for s in ('.c', '.out')) + self.do_run_from_file(src, output) + def test_direct_string_constant_usage(self): if self.emcc_args is None: return self.skip('requires libcxx') |