Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: test/mjsunit/asm/math-ceil.js

Issue 2663243002: [asm] Fix lots of invalid asm.js tests (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/asm/math-abs.js ('k') | test/mjsunit/asm/math-clz32.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function Module(stdlib) { 5 function Module(stdlib) {
6 "use asm"; 6 "use asm";
7 7
8 var ceil = stdlib.Math.ceil; 8 var ceil = stdlib.Math.ceil;
9 9
10 // f: double -> float 10 // f: double -> float
11 function f(a) { 11 function f(a) {
12 a = +a; 12 a = +a;
13 return ceil(a); 13 return +ceil(a);
14 } 14 }
15 15
16 return { f: f }; 16 return { f: f };
17 } 17 }
18 18
19 var f = Module({ Math: Math }).f; 19 var f = Module({ Math: Math }).f;
20 20
21 assertTrue(isNaN(f(NaN))); 21 assertTrue(isNaN(f(NaN)));
22 assertTrue(isNaN(f(undefined))); 22 assertTrue(isNaN(f(undefined)));
23 assertTrue(isNaN(f(function() {}))); 23 assertTrue(isNaN(f(function() {})));
24 24
25 assertEquals(0, f(0)); 25 assertEquals(0, f(0));
26 assertEquals(+0, f(+0)); 26 assertEquals(+0, f(+0));
27 assertEquals(-0, f(-0)); 27 assertEquals(-0, f(-0));
28 assertEquals(1, f(0.49999)); 28 assertEquals(1, f(0.49999));
29 assertEquals(1, f(0.6)); 29 assertEquals(1, f(0.6));
30 assertEquals(1, f(0.5)); 30 assertEquals(1, f(0.5));
31 assertEquals(-0, f(-0.1)); 31 assertEquals(-0, f(-0.1));
32 assertEquals(-0, f(-0.5)); 32 assertEquals(-0, f(-0.5));
33 assertEquals(-0, f(-0.6)); 33 assertEquals(-0, f(-0.6));
34 assertEquals(-1, f(-1.6)); 34 assertEquals(-1, f(-1.6));
35 assertEquals(-0, f(-0.50001)); 35 assertEquals(-0, f(-0.50001));
36 36
37 assertEquals("Infinity", String(f(Infinity))); 37 assertEquals("Infinity", String(f(Infinity)));
38 assertEquals("-Infinity", String(f(-Infinity))); 38 assertEquals("-Infinity", String(f(-Infinity)));
OLDNEW
« no previous file with comments | « test/mjsunit/asm/math-abs.js ('k') | test/mjsunit/asm/math-clz32.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698