Chromium Code Reviews| Index: test/typed_buffers_test.dart |
| diff --git a/test/typed_buffers_test.dart b/test/typed_buffers_test.dart |
| index 9e97592adb85257f6ecfc61769d6906c894ad63d..2fad382d4cb22c15cab1b7131a164b3dbb152933 100644 |
| --- a/test/typed_buffers_test.dart |
| +++ b/test/typed_buffers_test.dart |
| @@ -166,16 +166,16 @@ Rounder roundInt(bits) { |
| int clampUint8(x) => x < 0 ? 0 : x > 255 ? 255 : x; |
| -void testUint(int bits, var buffer, {String testOn}) { |
| +void testUint(int bits, buffer(int length), {String testOn}) { |
| int min = 0; |
| - Function round = roundUint(bits); |
| + var round = roundUint(bits); |
|
floitsch
2016/05/09 13:20:59
Nit:
I find this much harder to read.
Maybe change
nweiz
2016/05/09 18:28:34
Done.
|
| int max = round(-1); |
| test("Uint${bits}Buffer", () { |
| testIntBuffer(bits, min, max, buffer, round); |
| }, testOn: testOn); |
| } |
| -void testInt(int bits, var buffer, {String testOn}) { |
| +void testInt(int bits, buffer(int length), {String testOn}) { |
| int min = -(1 << (bits - 1)); |
| int max = -(min + 1); |
| test("Int${bits}Buffer", () { |
| @@ -231,7 +231,7 @@ void testIntBuffer(int bits, int min, int max, |
| assert(round(max) == max); |
| // All int buffers default to the value 0. |
| var buffer = create(0); |
| - List<int> list = buffer; // Check the type. |
| + expect(buffer, new isInstanceOf<List<int>>()); |
| expect(buffer.length, equals(0)); |
| var bytes = bits ~/ 8; |
| @@ -338,7 +338,7 @@ void doubleEqual(x, y) { |
| testFloatBuffer(int bitSize, List samples, create(), double round(double v)) { |
| test("Float${bitSize}Buffer", () { |
| var buffer = create(); |
| - List<double> list = buffer; // Test type. |
| + expect(buffer, new isInstanceOf<List<double>>()); |
| int byteSize = bitSize ~/ 8; |
| expect(buffer.length, equals(0)); |
| @@ -393,7 +393,7 @@ testFloatBuffer(int bitSize, List samples, create(), double round(double v)) { |
| } |
| testFloat32x4Buffer(List floatSamples) { |
| - List float4Samples = []; |
| + var float4Samples = <Float32x4>[]; |
| for (int i = 0; i < floatSamples.length - 3; i++) { |
| float4Samples.add(new Float32x4(floatSamples[i], |
| floatSamples[i + 1], |
| @@ -418,7 +418,7 @@ testFloat32x4Buffer(List floatSamples) { |
| test("Float32x4Buffer", () { |
| var buffer = new Float32x4Buffer(5); |
| - List<Float32x4> list = buffer; |
| + expect(buffer, new isInstanceOf<List<Float32x4>>()); |
| expect(buffer.length, equals(5)); |
| expect(buffer.elementSizeInBytes, equals(128 ~/ 8)); |
| @@ -458,15 +458,14 @@ testFloat32x4Buffer(List floatSamples) { |
| }); |
| } |
| -void testInt32x4Buffer(intSamples) { |
| +void testInt32x4Buffer(List<int> intSamples) { |
| test("Int32x4Buffer", () { |
| Function round = roundInt(32); |
| - int bits = 128; |
| int bytes = 128 ~/ 8; |
| Matcher equals32x4(Int32x4 expected) => new MatchesInt32x4(expected); |
| var buffer = new Int32x4Buffer(0); |
| - List<Int32x4> list = buffer; // It's a List. |
| + expect(buffer, new isInstanceOf<List<Int32x4>>()); |
| expect(buffer.length, equals(0)); |
| expect(buffer.elementSizeInBytes, equals(bytes)); |