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

Unified Diff: test/codegen/lib/typed_data/byte_data_test.dart

Issue 1673863002: Infra for running lib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Reformat Created 4 years, 10 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 | « test/codegen/expect/lib-typed_data-all.js ('k') | test/codegen/lib/typed_data/constructor_checks_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/lib/typed_data/byte_data_test.dart
diff --git a/test/codegen/lib/typed_data/byte_data_test.dart b/test/codegen/lib/typed_data/byte_data_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2b0e3ea354061a3230a5890b5f424ace3b6a1954
--- /dev/null
+++ b/test/codegen/lib/typed_data/byte_data_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:typed_data';
+import "package:expect/expect.dart";
+
+main() {
+ testRegress10898();
+}
+
+testRegress10898() {
+ ByteData data = new ByteData(16);
+ Expect.equals(16, data.lengthInBytes);
+ for (int i = 0; i < data.lengthInBytes; i++) {
+ Expect.equals(0, data.getInt8(i));
+ data.setInt8(i, 42 + i);
+ Expect.equals(42 + i, data.getInt8(i));
+ }
+
+ ByteData backing = new ByteData(16);
+ ByteData view = new ByteData.view(backing.buffer);
+ for (int i = 0; i < view.lengthInBytes; i++) {
+ Expect.equals(0, view.getInt8(i));
+ view.setInt8(i, 87 + i);
+ Expect.equals(87 + i, view.getInt8(i));
+ }
+
+ view = new ByteData.view(backing.buffer, 4);
+ Expect.equals(12, view.lengthInBytes);
+ for (int i = 0; i < view.lengthInBytes; i++) {
+ Expect.equals(87 + i + 4, view.getInt8(i));
+ }
+
+ view = new ByteData.view(backing.buffer, 8, 4);
+ Expect.equals(4, view.lengthInBytes);
+ for (int i = 0; i < view.lengthInBytes; i++) {
+ Expect.equals(87 + i + 8, view.getInt8(i));
+ }
+}
« no previous file with comments | « test/codegen/expect/lib-typed_data-all.js ('k') | test/codegen/lib/typed_data/constructor_checks_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698