Chromium Code Reviews| Index: tests/standalone/byte_array_test.dart |
| diff --git a/tests/standalone/byte_array_test.dart b/tests/standalone/byte_array_test.dart |
| index 2f60f29d18995376bba405495ea19845989a6886..388f933f2c5cdb7112dd074bb79b1d16294c0967 100644 |
| --- a/tests/standalone/byte_array_test.dart |
| +++ b/tests/standalone/byte_array_test.dart |
| @@ -20,6 +20,36 @@ void testCreateByteArray() { |
| for (int i = 0; i < 10; i++) { |
| Expect.equals(0, byteArray[i]); |
| } |
| + |
| +} |
| + |
| +void testUnsignedByteArrayRange() { |
| + Uint8List byteArray; |
| + byteArray = new Uint8List(10); |
| + |
| + byteArray[1] = 255; |
| + Expect.equals(255, byteArray[1]); |
| + byteArray[1] = 0; |
| + Expect.equals(0, byteArray[1]); |
| + |
| + // These should eventually throw. |
|
srdjan
2012/10/16 17:56:01
Don't they throw?
You can use Expect.throws(...) t
|
| + byteArray[1] = 256; |
| + byteArray[1] = -1; |
| + byteArray[2] = -129; |
| +} |
| + |
| +void testByteArrayRange() { |
| + Int8List byteArray; |
| + byteArray = new Int8List(10); |
| + byteArray[1] = 0; |
| + Expect.equals(0, byteArray[1]); |
| + byteArray[2] = -128; |
| + Expect.equals(-128, byteArray[2]); |
| + byteArray[3] = 127; |
| + Expect.equals(127, byteArray[3]); |
| + // This should eventually throw. |
|
srdjan
2012/10/16 17:56:01
ditto
|
| + byteArray[0] = 128; |
| + byteArray[4] = -129; |
| } |
| void testSetRange() { |
| @@ -81,6 +111,8 @@ void testIndexOf() { |
| main() { |
| for (int i = 0; i < 2000; i++) { |
| testCreateByteArray(); |
| + testByteArrayRange(); |
| + testUnsignedByteArrayRange(); |
| testSetRange(); |
| testIndexOutOfRange(); |
| testIndexOf(); |