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

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 11418107: Resolve C++11 narrowing conversion errors when compiling with GCC 4.7. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 Dart_CObject* root = api_reader.ReadMessage(); 521 Dart_CObject* root = api_reader.ReadMessage();
522 EXPECT_EQ(Dart_CObject::kString, root->type); 522 EXPECT_EQ(Dart_CObject::kString, root->type);
523 EXPECT_STREQ(cstr, root->value.as_string); 523 EXPECT_STREQ(cstr, root->value.as_string);
524 CheckEncodeDecodeMessage(root); 524 CheckEncodeDecodeMessage(root);
525 } 525 }
526 526
527 527
528 TEST_CASE(SerializeString) { 528 TEST_CASE(SerializeString) {
529 TestString("This string shall be serialized"); 529 TestString("This string shall be serialized");
530 TestString("æøå"); // This file is UTF-8 encoded. 530 TestString("æøå"); // This file is UTF-8 encoded.
531 char data[] = {0x01, 531 const char* data = "\x01"
532 0x7f, 532 "\x7F"
533 0xc2, 0x80, // 0x80 533 "\xC2\x80" // U+0080
534 0xdf, 0xbf, // 0x7ff 534 "\xDF\xBF" // U+07FF
535 0xe0, 0xa0, 0x80, // 0x800 535 "\xE0\xA0\x80" // U+0800
536 0xef, 0xbf, 0xbf, // 0xffff 536 "\xEF\xBF\xBF"; // U+FFFF
537 0x00}; // String termination. 537
538 TestString(data); 538 TestString(data);
539 // TODO(sgjesse): Add tests with non-BMP characters. 539 // TODO(sgjesse): Add tests with non-BMP characters.
540 } 540 }
541 541
542 542
543 TEST_CASE(SerializeArray) { 543 TEST_CASE(SerializeArray) {
544 StackZone zone(Isolate::Current()); 544 StackZone zone(Isolate::Current());
545 545
546 // Write snapshot with object content. 546 // Write snapshot with object content.
547 uint8_t* buffer; 547 uint8_t* buffer;
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 2100
2101 object.type = Dart_CObject::kString; 2101 object.type = Dart_CObject::kString;
2102 object.value.as_string = const_cast<char*>("456"); 2102 object.value.as_string = const_cast<char*>("456");
2103 EXPECT(Dart_PostCObject(send_port_id, &object)); 2103 EXPECT(Dart_PostCObject(send_port_id, &object));
2104 2104
2105 object.type = Dart_CObject::kString; 2105 object.type = Dart_CObject::kString;
2106 object.value.as_string = const_cast<char*>("æøå"); 2106 object.value.as_string = const_cast<char*>("æøå");
2107 EXPECT(Dart_PostCObject(send_port_id, &object)); 2107 EXPECT(Dart_PostCObject(send_port_id, &object));
2108 2108
2109 // Try to post an invalid UTF-8 sequence (lead surrogate). 2109 // Try to post an invalid UTF-8 sequence (lead surrogate).
2110 char data[] = {0xed, 0xa0, 0x80, 0}; // 0xd800 2110 const char* data = "\xED\xA0\x80"; // U+D800
2111 object.type = Dart_CObject::kString; 2111 object.type = Dart_CObject::kString;
2112 object.value.as_string = const_cast<char*>(data); 2112 object.value.as_string = const_cast<char*>(data);
2113 EXPECT(!Dart_PostCObject(send_port_id, &object)); 2113 EXPECT(!Dart_PostCObject(send_port_id, &object));
2114 2114
2115 object.type = Dart_CObject::kDouble; 2115 object.type = Dart_CObject::kDouble;
2116 object.value.as_double = 3.14; 2116 object.value.as_double = 3.14;
2117 EXPECT(Dart_PostCObject(send_port_id, &object)); 2117 EXPECT(Dart_PostCObject(send_port_id, &object));
2118 2118
2119 object.type = Dart_CObject::kArray; 2119 object.type = Dart_CObject::kArray;
2120 object.value.as_array.length = 0; 2120 object.value.as_array.length = 0;
(...skipping 23 matching lines...) Expand all
2144 EXPECT(Dart_ErrorHasException(result)); 2144 EXPECT(Dart_ErrorHasException(result));
2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2146 Dart_GetError(result)); 2146 Dart_GetError(result));
2147 2147
2148 Dart_ExitScope(); 2148 Dart_ExitScope();
2149 } 2149 }
2150 2150
2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2152 2152
2153 } // namespace dart 2153 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698