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

Unified Diff: test/cctest/test-conversions.cc

Issue 1038313004: fix special index parsing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: NaN test Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.cc ('k') | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-conversions.cc
diff --git a/test/cctest/test-conversions.cc b/test/cctest/test-conversions.cc
index 789425119d5b90bd8a6c8f2e4e7bb08229e6eed1..463a4abe3fa96bfbcec52a3b78378968e8575724 100644
--- a/test/cctest/test-conversions.cc
+++ b/test/cctest/test-conversions.cc
@@ -367,53 +367,42 @@ TEST(BitField64) {
static void CheckNonArrayIndex(bool expected, const char* chars) {
auto isolate = CcTest::i_isolate();
auto string = isolate->factory()->NewStringFromAsciiChecked(chars);
- CHECK_EQ(expected, IsNonArrayIndexInteger(*string));
+ CHECK_EQ(expected, IsSpecialIndex(isolate->unicode_cache(), *string));
}
-TEST(NonArrayIndexParsing) {
+TEST(SpecialIndexParsing) {
auto isolate = CcTest::i_isolate();
HandleScope scope(isolate);
CheckNonArrayIndex(false, "");
CheckNonArrayIndex(false, "-");
- CheckNonArrayIndex(false, "0");
+ CheckNonArrayIndex(true, "0");
+ CheckNonArrayIndex(true, "-0");
CheckNonArrayIndex(false, "01");
CheckNonArrayIndex(false, "-01");
- CheckNonArrayIndex(false, "4294967295");
- CheckNonArrayIndex(false, "429496.7295");
- CheckNonArrayIndex(false, "43s3");
- CheckNonArrayIndex(true, "-0");
+ CheckNonArrayIndex(true, "0.5");
+ CheckNonArrayIndex(true, "-0.5");
+ CheckNonArrayIndex(true, "1");
CheckNonArrayIndex(true, "-1");
+ CheckNonArrayIndex(true, "10");
+ CheckNonArrayIndex(true, "-10");
+ CheckNonArrayIndex(true, "NaN");
+ CheckNonArrayIndex(true, "Infinity");
+ CheckNonArrayIndex(true, "-Infinity");
+ CheckNonArrayIndex(true, "4294967295");
+ CheckNonArrayIndex(true, "429496.7295");
+ CheckNonArrayIndex(true, "1.3333333333333333");
+ CheckNonArrayIndex(false, "1.3333333333333339");
+ CheckNonArrayIndex(true, "1.333333333333331e+222");
+ CheckNonArrayIndex(true, "-1.3333333333333211e+222");
+ CheckNonArrayIndex(false, "-1.3333333333333311e+222");
+ CheckNonArrayIndex(true, "429496.7295");
+ CheckNonArrayIndex(false, "43s3");
CheckNonArrayIndex(true, "4294967296");
CheckNonArrayIndex(true, "-4294967296");
- CheckNonArrayIndex(
- true,
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296");
- CheckNonArrayIndex(
- true,
- "-429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296"
- "429496729642949672964294967296429496729642949672964294967296");
+ CheckNonArrayIndex(true, "999999999999999");
+ CheckNonArrayIndex(false, "9999999999999999");
+ CheckNonArrayIndex(true, "-999999999999999");
+ CheckNonArrayIndex(false, "-9999999999999999");
+ CheckNonArrayIndex(false, "42949672964294967296429496729694966");
}
« no previous file with comments | « src/lookup.cc ('k') | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698