aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-02 15:36:36 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-11-02 15:36:36 -0700
commit132bbc90e82bdeef7410ed50c9d6c513bc2d28ba (patch)
tree5ba65f96c190bca82a79e6afccd33a7e3eb7fabc /tests/runner.py
parent608ab508328f76a988d3792174b393dfacb8f99f (diff)
scanf improvements
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py
index c33f7565..517f2bcf 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -236,7 +236,7 @@ if 'benchmark' not in str(sys.argv):
# If not provided with expected output, then generate it right now, using lli
if expected_output is None:
expected_output = self.run_llvm_interpreter([filename + '.o'])
- print '[autogenerated expected output: %20s]' % (expected_output[0:17].replace('\n', '')+'...')
+ print '[autogenerated expected output: %20s]' % (expected_output[0:30].replace('\n', '|')+'...')
# Run in both JavaScript engines, if optimizing - significant differences there (typed arrays)
if js_engines is None:
@@ -2349,6 +2349,29 @@ if 'benchmark' not in str(sys.argv):
'''
self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected))
+ def test_sscanf(self):
+ src = r'''
+ #include <stdio.h>
+ #include <string.h>
+
+ int main () {
+ #define CHECK(str) \
+ { \
+ char name[1000]; \
+ memset(name, 0, 1000); \
+ int prio = 99; \
+ sscanf(str, "%s %d", name, &prio); \
+ printf("%s : %d\n", name, prio); \
+ }
+ CHECK("en-us 2");
+ CHECK("en-r");
+ CHECK("en 3");
+
+ return 0;
+ }
+ '''
+ self.do_run(src)
+
def test_langinfo(self):
src = open(path_from_root('tests', 'langinfo', 'test.c'), 'r').read()
expected = open(path_from_root('tests', 'langinfo', 'output.txt'), 'r').read()