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

Side by Side Diff: test/mjsunit/array-indexing.js

Issue 1433473003: Ship Harmony ToLength (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add --harmony-tolength flag back into tests Created 5 years, 1 month 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 | « src/flag-definitions.h ('k') | test/mjsunit/array-length.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 assertEquals(-1, Array.prototype.indexOf.call(dense_object, 87)); 104 assertEquals(-1, Array.prototype.indexOf.call(dense_object, 87));
105 105
106 assertEquals(0, Array.prototype.indexOf.call(sparse_object, 42)); 106 assertEquals(0, Array.prototype.indexOf.call(sparse_object, 42));
107 assertEquals(100000, Array.prototype.indexOf.call(sparse_object, 37)); 107 assertEquals(100000, Array.prototype.indexOf.call(sparse_object, 37));
108 assertEquals(-1, Array.prototype.indexOf.call(sparse_object, 87)); 108 assertEquals(-1, Array.prototype.indexOf.call(sparse_object, 87));
109 109
110 assertEquals(10, Array.prototype.indexOf.call(funky_object, 42)); 110 assertEquals(10, Array.prototype.indexOf.call(funky_object, 42));
111 assertEquals(-1, Array.prototype.indexOf.call(funky_object, 42, 15)); 111 assertEquals(-1, Array.prototype.indexOf.call(funky_object, 42, 15));
112 assertEquals(-1, Array.prototype.indexOf.call(funky_object, 37)); 112 assertEquals(-1, Array.prototype.indexOf.call(funky_object, 37));
113 113
114 assertEquals(-1, Array.prototype.indexOf.call(infinite_object, 42)); 114 assertEquals(10, Array.prototype.indexOf.call(infinite_object, 42));
115 115
116 // ---------------------------------------------------------------------- 116 // ----------------------------------------------------------------------
117 // Array.prototype.lastIndexOf. 117 // Array.prototype.lastIndexOf.
118 // ---------------------------------------------------------------------- 118 // ----------------------------------------------------------------------
119 119
120 // Negative cases. 120 // Negative cases.
121 assertEquals(-1, [].lastIndexOf(1)); 121 assertEquals(-1, [].lastIndexOf(1));
122 assertEquals(-1, array.lastIndexOf(1, -17)); 122 assertEquals(-1, array.lastIndexOf(1, -17));
123 123
124 assertEquals(9, array.lastIndexOf(1)); 124 assertEquals(9, array.lastIndexOf(1));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 assertEquals(-1, Array.prototype.lastIndexOf.call(dense_object, 87)); 176 assertEquals(-1, Array.prototype.lastIndexOf.call(dense_object, 87));
177 177
178 assertEquals(0, Array.prototype.lastIndexOf.call(sparse_object, 42)); 178 assertEquals(0, Array.prototype.lastIndexOf.call(sparse_object, 42));
179 assertEquals(100000, Array.prototype.lastIndexOf.call(sparse_object, 37)); 179 assertEquals(100000, Array.prototype.lastIndexOf.call(sparse_object, 37));
180 assertEquals(-1, Array.prototype.lastIndexOf.call(sparse_object, 87)); 180 assertEquals(-1, Array.prototype.lastIndexOf.call(sparse_object, 87));
181 181
182 assertEquals(10, Array.prototype.lastIndexOf.call(funky_object, 42, 15)); 182 assertEquals(10, Array.prototype.lastIndexOf.call(funky_object, 42, 15));
183 assertEquals(10, Array.prototype.lastIndexOf.call(funky_object, 42)); 183 assertEquals(10, Array.prototype.lastIndexOf.call(funky_object, 42));
184 assertEquals(-1, Array.prototype.lastIndexOf.call(funky_object, 37)); 184 assertEquals(-1, Array.prototype.lastIndexOf.call(funky_object, 37));
185 185
186 assertEquals(-1, Array.prototype.lastIndexOf.call(infinite_object, 42)); 186 // This call would take too long because it would search backwards from 2**53-1
187 // assertEquals(-1, Array.prototype.lastIndexOf.call(infinite_object, 42));
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | test/mjsunit/array-length.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698