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

Unified Diff: runtime/tests/vm/dart/byte_array_test.dart

Issue 10653002: Fix some warnings in the core library identified by the static analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
« runtime/lib/byte_array.dart ('K') | « runtime/lib/string_buffer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/tests/vm/dart/byte_array_test.dart
diff --git a/runtime/tests/vm/dart/byte_array_test.dart b/runtime/tests/vm/dart/byte_array_test.dart
index fc83c0abaa675d43bb34d7068d31ca8ec9a62245..13457eb2ded5bcddef7c48a3cb683cae35dc7654 100644
--- a/runtime/tests/vm/dart/byte_array_test.dart
+++ b/runtime/tests/vm/dart/byte_array_test.dart
@@ -932,6 +932,10 @@ class ByteArrayTest {
Expect.throws(() { new Int8List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Int8List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Int8List);
siva 2012/06/21 23:33:08 maybe a negative test too, e.g: Expect.IsFalse(wh
cshapiro 2012/06/22 04:27:00 Probably not a bad idea. However, I do a lot of t
siva 2012/06/22 18:12:30 No I meant just one negative test each just to ens
+ Expect.equals(12, whole.length);
var view = new Int8List.view(array.asByteArray(), 1, array.length - 2);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Int8List);
@@ -1051,6 +1055,10 @@ class ByteArrayTest {
Expect.throws(() { new Uint8List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Uint8List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Uint8List);
+ Expect.equals(12, whole.length);
var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Uint8List);
@@ -1149,6 +1157,10 @@ class ByteArrayTest {
Expect.throws(() { new Int16List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Int16List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Int16List);
+ Expect.equals(12, whole.length);
var view = new Int16List.view(array.asByteArray(), 2, 10);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Int16List);
@@ -1275,6 +1287,10 @@ class ByteArrayTest {
Expect.throws(() { new Uint16List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Uint16List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Uint16List);
+ Expect.equals(12, whole.length);
var view = new Uint16List.view(array.asByteArray(), 2, 10);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Uint16List);
@@ -1378,6 +1394,10 @@ class ByteArrayTest {
Expect.throws(() { new Int32List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Int32List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Int32List);
+ Expect.equals(12, whole.length);
var view = new Int32List.view(array.asByteArray(), 4, 10);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Int32List);
@@ -1528,6 +1548,10 @@ class ByteArrayTest {
Expect.throws(() { new Uint32List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Uint32List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Uint32List);
+ Expect.equals(12, whole.length);
var view = new Uint32List.view(array.asByteArray(), 4, 10);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Uint32List);
@@ -1648,6 +1672,10 @@ class ByteArrayTest {
Expect.throws(() { new Int64List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Int64List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Int64List);
+ Expect.equals(12, whole.length);
var view = new Int64List.view(array.asByteArray(), 8, 10);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Int64List);
@@ -1835,6 +1863,10 @@ class ByteArrayTest {
Expect.throws(() { new Uint64List.view(array.asByteArray(),
array.length - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Uint64List.view(array.asByteArray());
+ Expect.isTrue(whole is List<int>);
+ Expect.isTrue(whole is Uint64List);
+ Expect.equals(12, whole.length);
var view = new Uint64List.view(array.asByteArray(), 8, 10);
Expect.isTrue(view is List<int>);
Expect.isTrue(view is Uint64List);
@@ -1983,8 +2015,13 @@ class ByteArrayTest {
Expect.throws(() { new Float32List.view(array.asByteArray(),
array.lengthInBytes() - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Float32List.view(array.asByteArray());
+ Expect.isTrue(whole is List<double>);
+ Expect.isTrue(whole is Float32List);
+ Expect.equals(12, whole.length);
var view = new Float32List.view(array.asByteArray(), 4, 10);
Expect.isTrue(view is List<double>);
+ Expect.isTrue(view is Float32List);
Expect.equals(10, view.length);
Expect.equals(4, view.bytesPerElement());
Expect.equals(40, view.lengthInBytes());
@@ -2076,8 +2113,13 @@ class ByteArrayTest {
Expect.throws(() { new Float64List.view(array.asByteArray(),
array.lengthInBytes() - 1, 2); },
(e) { return e is IndexOutOfRangeException; });
+ var whole = new Float64List.view(array.asByteArray());
+ Expect.isTrue(whole is List<double>);
+ Expect.isTrue(whole is Float64List);
+ Expect.equals(12, whole.length);
var view = new Float64List.view(array.asByteArray(), 8, 10);
Expect.isTrue(view is List<double>);
+ Expect.isTrue(view is Float64List);
Expect.equals(10, view.length);
Expect.equals(8, view.bytesPerElement());
Expect.equals(80, view.lengthInBytes());
« runtime/lib/byte_array.dart ('K') | « runtime/lib/string_buffer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698