aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2011-02-05 20:06:11 -0800
committerAlon Zakai <azakai@mozilla.com>2011-02-05 20:06:11 -0800
commit0805b2bec3ee27785259d76f1c9a5ccc555f1d6b (patch)
treef8b022f2a83824a0b958e6ac0411121ddfb804d3 /tests/runner.py
parent94db1931556f0476b40d268db641a68e6fa353ee (diff)
mathop fixes +test
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 09e53251..1c2e6f1c 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -315,6 +315,36 @@ if 'benchmark' not in sys.argv:
'''
self.do_test(src, '*5,23,10,19,121,1,37,1,0*\n0:-1,1:134217727,2:4194303,3:131071,4:4095,5:127,6:3,7:0,8:0*\n*56,09*\n*246,296*\n*21*')
+ def test_sintvars(self):
+ src = '''
+ #include <stdio.h>
+ struct S {
+ char *match_start;
+ char *strstart;
+ };
+ int main()
+ {
+ struct S _s;
+ struct S *s = &_s;
+ unsigned short int sh;
+
+ s->match_start = (char*)32522;
+ s->strstart = (char*)(32780);
+ printf("*%d,%d,%d*\\n", (int)s->strstart, (int)s->match_start, (int)(s->strstart - s->match_start));
+ sh = s->strstart - s->match_start;
+ printf("*%d,%d*\\n", sh, sh>>7);
+
+ s->match_start = (char*)32999;
+ s->strstart = (char*)(32780);
+ printf("*%d,%d,%d*\\n", (int)s->strstart, (int)s->match_start, (int)(s->strstart - s->match_start));
+ sh = s->strstart - s->match_start;
+ printf("*%d,%d*\\n", sh, sh>>7);
+ }
+ '''
+ output = '*32780,32522,258*\n*258,2*\n*32780,32999,-219*\n*65317,510*'
+ global CORRECT_OVERFLOWS; CORRECT_OVERFLOWS = 0 # We should not need overflow correction to get this right
+ self.do_test(src, output, force_c=True)
+
def test_unsigned(self):
src = '''
#include <stdio.h>