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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 221973004: - Handle doubles transferred in message snapshots specially. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « runtime/vm/snapshot_ids.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
===================================================================
--- runtime/vm/snapshot_test.cc (revision 34679)
+++ runtime/vm/snapshot_test.cc (working copy)
@@ -2093,9 +2093,13 @@
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
- for (int i = 0; i < kArrayLength; i++) {
- Dart_CObject* element = root->value.as_array.values[i];
- EXPECT_EQ(root->value.as_array.values[0], element);
+ Dart_CObject* element = root->value.as_array.values[0];
+ EXPECT_EQ(Dart_CObject_kDouble, element->type);
+ EXPECT_EQ(3.14, element->value.as_double);
+ for (int i = 1; i < kArrayLength; i++) {
+ element = root->value.as_array.values[i];
+ // Double values are expected to not be canonicalized in messages.
+ EXPECT_NE(root->value.as_array.values[0], element);
EXPECT_EQ(Dart_CObject_kDouble, element->type);
EXPECT_EQ(3.14, element->value.as_double);
}
@@ -2140,14 +2144,21 @@
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
- for (int i = 0; i < kArrayLength; i++) {
- Dart_CObject* element = root->value.as_array.values[i];
+ Dart_CObject* element = root->value.as_array.values[0];
+ EXPECT_EQ(Dart_CObject_kString, element->type);
+ EXPECT_STREQ("A", element->value.as_string);
+ element = root->value.as_array.values[1];
+ EXPECT_EQ(Dart_CObject_kDouble, element->type);
+ EXPECT_STREQ(2.72, element->value.as_double);
+ for (int i = 2; i < kArrayLength; i++) {
+ element = root->value.as_array.values[i];
if ((i % 2) == 0) {
EXPECT_EQ(root->value.as_array.values[0], element);
EXPECT_EQ(Dart_CObject_kString, element->type);
EXPECT_STREQ("A", element->value.as_string);
} else {
- EXPECT_EQ(root->value.as_array.values[1], element);
+ // Double values are expected to not be canonicalized in messages.
+ EXPECT_NE(root->value.as_array.values[1], element);
EXPECT_EQ(Dart_CObject_kDouble, element->type);
EXPECT_STREQ(2.72, element->value.as_double);
}
@@ -2197,10 +2208,10 @@
"getDoubleList() {\n"
" var d = 3.14;\n"
" var list = [3.14, 3.14, 3.14, 3.14, 3.14, 3.14];\n"
- " list.add(3.14);;\n"
- " list.add(3.14);;\n"
- " list.add(3.14);;\n"
- " list.add(3.14);;\n"
+ " list.add(3.14);\n"
+ " list.add(3.14);\n"
+ " list.add(3.14);\n"
+ " list.add(3.14);\n"
" return list;\n"
"}\n"
"getTypedDataList() {\n"
@@ -2297,9 +2308,14 @@
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
- for (int i = 0; i < kArrayLength; i++) {
- Dart_CObject* element = root->value.as_array.values[i];
- EXPECT_EQ(root->value.as_array.values[0], element);
+ Dart_CObject* element = root->value.as_array.values[0];
+ // Double values are expected to not be canonicalized in messages.
+ EXPECT_EQ(Dart_CObject_kDouble, element->type);
+ EXPECT_EQ(3.14, element->value.as_double);
+ for (int i = 1; i < kArrayLength; i++) {
+ element = root->value.as_array.values[i];
+ // Double values are expected to not be canonicalized in messages.
+ EXPECT_NE(root->value.as_array.values[0], element);
EXPECT_EQ(Dart_CObject_kDouble, element->type);
EXPECT_EQ(3.14, element->value.as_double);
}
@@ -2344,14 +2360,21 @@
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
- for (int i = 0; i < kArrayLength; i++) {
+ Dart_CObject* element = root->value.as_array.values[0];
+ EXPECT_EQ(Dart_CObject_kString, element->type);
+ EXPECT_STREQ(".", element->value.as_string);
+ element = root->value.as_array.values[1];
+ EXPECT_EQ(Dart_CObject_kDouble, element->type);
+ EXPECT_STREQ(2.72, element->value.as_double);
+ for (int i = 2; i < kArrayLength; i++) {
Dart_CObject* element = root->value.as_array.values[i];
if ((i % 2) == 0) {
EXPECT_EQ(root->value.as_array.values[0], element);
EXPECT_EQ(Dart_CObject_kString, element->type);
EXPECT_STREQ(".", element->value.as_string);
} else {
- EXPECT_EQ(root->value.as_array.values[1], element);
+ // Double values are expected to not be canonicalized in messages.
+ EXPECT_NE(root->value.as_array.values[1], element);
EXPECT_EQ(Dart_CObject_kDouble, element->type);
EXPECT_STREQ(2.72, element->value.as_double);
}
« no previous file with comments | « runtime/vm/snapshot_ids.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698