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

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

Issue 10108025: Fix an invalid character escape sequence. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/globals.h" 5 #include "vm/globals.h"
6 #include "vm/unicode.h" 6 #include "vm/unicode.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 uint32_t expected[] = { 0xDB80, 0xDFFF }; 972 uint32_t expected[] = { 0xDB80, 0xDFFF };
973 uint32_t dst[ARRAY_SIZE(expected)]; 973 uint32_t dst[ARRAY_SIZE(expected)];
974 memset(dst, 0, sizeof(dst)); 974 memset(dst, 0, sizeof(dst));
975 bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst)); 975 bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
976 EXPECT(!is_valid); 976 EXPECT(!is_valid);
977 EXPECT(memcmp(expected, dst, sizeof(expected))); 977 EXPECT(memcmp(expected, dst, sizeof(expected)));
978 } 978 }
979 979
980 // 5.2.7 - U+DBFF U+DC00 = ed af bf ed b0 80 = "\xED\xAF\xBF\xED\xB0\x80" 980 // 5.2.7 - U+DBFF U+DC00 = ed af bf ed b0 80 = "\xED\xAF\xBF\xED\xB0\x80"
981 { 981 {
982 const char* src = "\xED\xAF\xBF\ED\xB0\x80"; 982 const char* src = "\xED\xAF\xBF\xED\xB0\x80";
983 uint32_t expected[] = { 0xDBFF, 0xDC00 }; 983 uint32_t expected[] = { 0xDBFF, 0xDC00 };
984 uint32_t dst[ARRAY_SIZE(expected)]; 984 uint32_t dst[ARRAY_SIZE(expected)];
985 memset(dst, 0, sizeof(dst)); 985 memset(dst, 0, sizeof(dst));
986 bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst)); 986 bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
987 EXPECT(!is_valid); 987 EXPECT(!is_valid);
988 EXPECT(memcmp(expected, dst, sizeof(expected))); 988 EXPECT(memcmp(expected, dst, sizeof(expected)));
989 } 989 }
990 990
991 // 5.2.8 - U+DBFF U+DFFF = ed af bf ed bf bf = "\xED\xAF\xBF\xED\xBF\xBF" 991 // 5.2.8 - U+DBFF U+DFFF = ed af bf ed bf bf = "\xED\xAF\xBF\xED\xBF\xBF"
992 { 992 {
(...skipping 25 matching lines...) Expand all
1018 uint32_t expected[] = { 0xFFFF }; 1018 uint32_t expected[] = { 0xFFFF };
1019 uint32_t dst[ARRAY_SIZE(expected)]; 1019 uint32_t dst[ARRAY_SIZE(expected)];
1020 memset(dst, 0, sizeof(dst)); 1020 memset(dst, 0, sizeof(dst));
1021 bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst)); 1021 bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
1022 EXPECT(is_valid); 1022 EXPECT(is_valid);
1023 EXPECT(!memcmp(expected, dst, sizeof(expected))); 1023 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1024 } 1024 }
1025 } 1025 }
1026 1026
1027 } // namespace dart 1027 } // 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