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

Unified Diff: test/mjsunit/harmony/math-log2-log10.js

Issue 119093006: Harmony: implement Math.log2 and Math.log10. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/harmony-math.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/math-log2-log10.js
diff --git a/test/mjsunit/regress/regress-crbug-233737.js b/test/mjsunit/harmony/math-log2-log10.js
similarity index 68%
copy from test/mjsunit/regress/regress-crbug-233737.js
copy to test/mjsunit/harmony/math-log2-log10.js
index 38b44e056f24397d319d544f41afaea09b8b8d95..2ab496012cbe9785920b7f43f87f4bf571fcd435 100644
--- a/test/mjsunit/regress/regress-crbug-233737.js
+++ b/test/mjsunit/harmony/math-log2-log10.js
@@ -25,18 +25,23 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --harmony-maths
-var a = new Array(2);
-a[0] = 1;
-assertTrue(%HasFastSmiElements(a));
-assertTrue(%HasFastHoleyElements(a));
+[Math.log10, Math.log2].forEach( function(fun) {
+ assertTrue(isNaN(fun(NaN)));
+ assertTrue(isNaN(fun(fun)));
+ assertTrue(isNaN(fun({ toString: function() { return NaN; } })));
+ assertTrue(isNaN(fun({ valueOf: function() { return -1; } })));
+ assertTrue(isNaN(fun({ valueOf: function() { return "abc"; } })));
+ assertTrue(isNaN(fun(-0.1)));
+ assertTrue(isNaN(fun(-1)));
+ assertEquals("-Infinity", String(fun(0)));
+ assertEquals("-Infinity", String(fun(-0)));
+ assertEquals(0, fun(1));
+ assertEquals("Infinity", String(fun(Infinity)));
+});
-function hole(i) {
- return a[i] << 0;
+for (var i = -300; i < 300; i += 0.7) {
+ assertEqualsDelta(i, Math.log10(Math.pow(10, i)), 1E-13);
+ assertEqualsDelta(i, Math.log2(Math.pow(2, i)), 1E-13);
}
-
-assertEquals(1, hole(0));
-assertEquals(1, hole(0));
-%OptimizeFunctionOnNextCall(hole);
-assertEquals(0, hole(1));
« no previous file with comments | « src/harmony-math.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698