diff options
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/tests/runner.py b/tests/runner.py index 62d09ee9..431a1c6e 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -598,13 +598,13 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows return 0; } ''' - self.do_run(src, '*1311918518731868200\n' + + self.do_run(src, '*1311918518731868041\n' + '0,0,0,1,1\n' + '1,0,1,0,1*\n' + '*245127260211081*\n' + '*245127260209443*\n' + - '*18446744073709552000*\n' + - '*576460752303423500*\n' + + '*18446744073709551615*\n' + + '*576460752303423487*\n' + 'm1: 127\n' + '*123*\n' + '*127*\n' + @@ -832,7 +832,6 @@ m_divisor is 1091269979 def test_i64_precise(self): if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') - Settings.PRECISE_I64_MATH = 1 src = r''' #include <inttypes.h> @@ -860,14 +859,39 @@ m_divisor is 1091269979 ''' self.do_run(src, open(path_from_root('tests', 'i64_precise.txt')).read()) - print 'TODO: make precise the default, and imprecise in -O3. Remove precise setting in this test and cube2hash' - print 'TODO: only include this code when needed' - #1/0. + # Verify that without precision, we do not include the precision code + Settings.PRECISE_I64_MATH = 0 + self.do_run(src, 'unsigned') + code = open(os.path.join(self.get_dir(), 'src.cpp.o.js')).read() + assert 'goog.math.Long' not in code and 'jsbn' not in code, 'i64 precise math should not have been included if not asked for' + + # Verify that even if we ask for precision, if it is not needed it is not included + Settings.PRECISE_I64_MATH = 1 + src = ''' + #include <inttypes.h> + #include <stdio.h> + + int main(int argc, char **argv) { + uint64_t x = 2125299906845564, y = 1225891506842664; + if (argc == 12) { + x = x >> 1; + y = y >> 1; + } + x = x & 12ULL; + y = y | 12ULL; + x = x ^ y; + x <<= 2; + y >>= 3; + printf("*%llu, %llu*\\n", x, y); + } + ''' + self.do_run(src, '*4903566027370624, 153236438355333*') + code = open(os.path.join(self.get_dir(), 'src.cpp.o.js')).read() + assert 'goog.math.Long' not in code and 'jsbn' not in code, 'i64 precise math should not have been included if not actually used' def test_cube2hash(self): # A good test of i64 math if Settings.USE_TYPED_ARRAYS != 2: return self.skip('requires ta2 C-style memory aliasing') - Settings.PRECISE_I64_MATH = 1 self.do_run('', 'Usage: hashstring <seed>', libraries=self.get_library('cube2hash', ['cube2hash.bc'], configure=None), includes=[path_from_root('tests', 'cube2hash')]) @@ -6854,7 +6878,10 @@ elif 'browser' in str(sys.argv): self.run_browser('something.html', 'You should not see animating gears.', '/report_gl_result?false') def test_glbook(self): - programs = self.get_library('glbook', [os.path.join('Chapter_2/Hello_Triangle/CH02_HelloTriangle.bc')], configure=None) + programs = self.get_library('glbook', [ + os.path.join('Chapter_2/Hello_Triangle/CH02_HelloTriangle.bc'), + os.path.join('Chapter_8/Simple_VertexShader/CH08_SimpleVertexShader.bc') + ], configure=None) for program in programs: print program self.reftest(path_from_root('tests', 'glbook', os.path.basename(program).replace('.bc', '.png'))) |