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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 9235067: Use ByteArray's native for Socket and File. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 3706)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -663,6 +663,30 @@
Dart_ObjectEquals(e1, e2, &is_equal);
EXPECT(is_equal);
}
+
+ uint8_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ result = Dart_ListSetAsBytes(obj1, 0, data, 10);
+ EXPECT_VALID(result);
+ for (intptr_t i = 0; i < 10; ++i) {
+ Dart_Handle e = Dart_ListGetAt(obj1, i);
+ int64_t value;
+ result = Dart_IntegerToInt64(e, &value);
+ EXPECT_VALID(result);
+ EXPECT_EQ(i, value);
+ }
+
+ for (intptr_t i = 0; i < 10; ++i) {
+ EXPECT_VALID(Dart_ListSetAt(obj1, i, Dart_NewInteger(10 - i)));
+ }
+ Dart_ListGetAsBytes(obj1, 0, data, 10);
+ for (intptr_t i = 0; i < 10; ++i) {
+ Dart_Handle e = Dart_ListGetAt(obj1, i);
+ EXPECT_VALID(e);
+ int64_t value;
+ result = Dart_IntegerToInt64(e, &value);
+ EXPECT_VALID(result);
+ EXPECT_EQ(10 - i, value);
+ }
Søren Gjesse 2012/02/01 08:16:08 Maybe add a test with list values outside the byte
Anders Johnsen 2012/02/01 18:54:53 Added new file.
}
#endif

Powered by Google App Engine
This is Rietveld 408576698