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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« runtime/lib/byte_array.dart ('K') | « runtime/lib/string_buffer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 class ByteArrayTest { 1 class ByteArrayTest {
2 static testInt8List() { 2 static testInt8List() {
3 Expect.throws(() { new Int8List(-1); }, 3 Expect.throws(() { new Int8List(-1); },
4 (e) { return e is IllegalArgumentException; }); 4 (e) { return e is IllegalArgumentException; });
5 var array = new Int8List(10); 5 var array = new Int8List(10);
6 Expect.isTrue(array is List<int>); 6 Expect.isTrue(array is List<int>);
7 Expect.equals(10, array.length); 7 Expect.equals(10, array.length);
8 Expect.equals(1, array.bytesPerElement()); 8 Expect.equals(1, array.bytesPerElement());
9 Expect.equals(10, array.lengthInBytes()); 9 Expect.equals(10, array.lengthInBytes());
10 Expect.listEquals([0, 0, 0, 0, 0, 10 Expect.listEquals([0, 0, 0, 0, 0,
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 (e) { return e is IndexOutOfRangeException; }); 925 (e) { return e is IndexOutOfRangeException; });
926 Expect.throws(() { new Int8List.view(array.asByteArray(), 926 Expect.throws(() { new Int8List.view(array.asByteArray(),
927 array.length); }, 927 array.length); },
928 (e) { return e is IndexOutOfRangeException; }); 928 (e) { return e is IndexOutOfRangeException; });
929 Expect.throws(() { new Int8List.view(array.asByteArray(), 929 Expect.throws(() { new Int8List.view(array.asByteArray(),
930 0, array.length + 1); }, 930 0, array.length + 1); },
931 (e) { return e is IndexOutOfRangeException; }); 931 (e) { return e is IndexOutOfRangeException; });
932 Expect.throws(() { new Int8List.view(array.asByteArray(), 932 Expect.throws(() { new Int8List.view(array.asByteArray(),
933 array.length - 1, 2); }, 933 array.length - 1, 2); },
934 (e) { return e is IndexOutOfRangeException; }); 934 (e) { return e is IndexOutOfRangeException; });
935 var whole = new Int8List.view(array.asByteArray());
936 Expect.isTrue(whole is List<int>);
937 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
938 Expect.equals(12, whole.length);
935 var view = new Int8List.view(array.asByteArray(), 1, array.length - 2); 939 var view = new Int8List.view(array.asByteArray(), 1, array.length - 2);
936 Expect.isTrue(view is List<int>); 940 Expect.isTrue(view is List<int>);
937 Expect.isTrue(view is Int8List); 941 Expect.isTrue(view is Int8List);
938 Expect.equals(10, view.length); 942 Expect.equals(10, view.length);
939 Expect.equals(1, view.bytesPerElement()); 943 Expect.equals(1, view.bytesPerElement());
940 Expect.equals(10, view.lengthInBytes()); 944 Expect.equals(10, view.lengthInBytes());
941 Expect.listEquals([-1, -1, -1, -1, -1, 945 Expect.listEquals([-1, -1, -1, -1, -1,
942 -1, -1, -1, -1, -1], 946 -1, -1, -1, -1, -1],
943 view); 947 view);
944 Expect.throws(() { view[-1] = 0; }, 948 Expect.throws(() { view[-1] = 0; },
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 (e) { return e is IndexOutOfRangeException; }); 1048 (e) { return e is IndexOutOfRangeException; });
1045 Expect.throws(() { new Uint8List.view(array.asByteArray(), 1049 Expect.throws(() { new Uint8List.view(array.asByteArray(),
1046 array.length); }, 1050 array.length); },
1047 (e) { return e is IndexOutOfRangeException; }); 1051 (e) { return e is IndexOutOfRangeException; });
1048 Expect.throws(() { new Uint8List.view(array.asByteArray(), 1052 Expect.throws(() { new Uint8List.view(array.asByteArray(),
1049 0, array.length + 1); }, 1053 0, array.length + 1); },
1050 (e) { return e is IndexOutOfRangeException; }); 1054 (e) { return e is IndexOutOfRangeException; });
1051 Expect.throws(() { new Uint8List.view(array.asByteArray(), 1055 Expect.throws(() { new Uint8List.view(array.asByteArray(),
1052 array.length - 1, 2); }, 1056 array.length - 1, 2); },
1053 (e) { return e is IndexOutOfRangeException; }); 1057 (e) { return e is IndexOutOfRangeException; });
1058 var whole = new Uint8List.view(array.asByteArray());
1059 Expect.isTrue(whole is List<int>);
1060 Expect.isTrue(whole is Uint8List);
1061 Expect.equals(12, whole.length);
1054 var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2); 1062 var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2);
1055 Expect.isTrue(view is List<int>); 1063 Expect.isTrue(view is List<int>);
1056 Expect.isTrue(view is Uint8List); 1064 Expect.isTrue(view is Uint8List);
1057 Expect.equals(10, view.length); 1065 Expect.equals(10, view.length);
1058 Expect.equals(1, view.bytesPerElement()); 1066 Expect.equals(1, view.bytesPerElement());
1059 Expect.equals(10, view.lengthInBytes()); 1067 Expect.equals(10, view.lengthInBytes());
1060 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1068 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1061 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], 1069 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
1062 view); 1070 view);
1063 Expect.throws(() { view[-1] = 0; }, 1071 Expect.throws(() { view[-1] = 0; },
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 (e) { return e is IndexOutOfRangeException; }); 1150 (e) { return e is IndexOutOfRangeException; });
1143 Expect.throws(() { new Int16List.view(array.asByteArray(), 1151 Expect.throws(() { new Int16List.view(array.asByteArray(),
1144 array.length); }, 1152 array.length); },
1145 (e) { return e is IndexOutOfRangeException; }); 1153 (e) { return e is IndexOutOfRangeException; });
1146 Expect.throws(() { new Int16List.view(array.asByteArray(), 1154 Expect.throws(() { new Int16List.view(array.asByteArray(),
1147 0, array.length + 1); }, 1155 0, array.length + 1); },
1148 (e) { return e is IndexOutOfRangeException; }); 1156 (e) { return e is IndexOutOfRangeException; });
1149 Expect.throws(() { new Int16List.view(array.asByteArray(), 1157 Expect.throws(() { new Int16List.view(array.asByteArray(),
1150 array.length - 1, 2); }, 1158 array.length - 1, 2); },
1151 (e) { return e is IndexOutOfRangeException; }); 1159 (e) { return e is IndexOutOfRangeException; });
1160 var whole = new Int16List.view(array.asByteArray());
1161 Expect.isTrue(whole is List<int>);
1162 Expect.isTrue(whole is Int16List);
1163 Expect.equals(12, whole.length);
1152 var view = new Int16List.view(array.asByteArray(), 2, 10); 1164 var view = new Int16List.view(array.asByteArray(), 2, 10);
1153 Expect.isTrue(view is List<int>); 1165 Expect.isTrue(view is List<int>);
1154 Expect.isTrue(view is Int16List); 1166 Expect.isTrue(view is Int16List);
1155 Expect.equals(10, view.length); 1167 Expect.equals(10, view.length);
1156 Expect.equals(2, view.bytesPerElement()); 1168 Expect.equals(2, view.bytesPerElement());
1157 Expect.equals(20, view.lengthInBytes()); 1169 Expect.equals(20, view.lengthInBytes());
1158 Expect.listEquals([-1, -1, -1, -1, -1, 1170 Expect.listEquals([-1, -1, -1, -1, -1,
1159 -1, -1, -1, -1, -1], 1171 -1, -1, -1, -1, -1],
1160 view); 1172 view);
1161 Expect.throws(() { view[-1] = 0; }, 1173 Expect.throws(() { view[-1] = 0; },
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 (e) { return e is IndexOutOfRangeException; }); 1280 (e) { return e is IndexOutOfRangeException; });
1269 Expect.throws(() { new Uint16List.view(array.asByteArray(), 1281 Expect.throws(() { new Uint16List.view(array.asByteArray(),
1270 array.length); }, 1282 array.length); },
1271 (e) { return e is IndexOutOfRangeException; }); 1283 (e) { return e is IndexOutOfRangeException; });
1272 Expect.throws(() { new Uint16List.view(array.asByteArray(), 1284 Expect.throws(() { new Uint16List.view(array.asByteArray(),
1273 0, array.length + 1); }, 1285 0, array.length + 1); },
1274 (e) { return e is IndexOutOfRangeException; }); 1286 (e) { return e is IndexOutOfRangeException; });
1275 Expect.throws(() { new Uint16List.view(array.asByteArray(), 1287 Expect.throws(() { new Uint16List.view(array.asByteArray(),
1276 array.length - 1, 2); }, 1288 array.length - 1, 2); },
1277 (e) { return e is IndexOutOfRangeException; }); 1289 (e) { return e is IndexOutOfRangeException; });
1290 var whole = new Uint16List.view(array.asByteArray());
1291 Expect.isTrue(whole is List<int>);
1292 Expect.isTrue(whole is Uint16List);
1293 Expect.equals(12, whole.length);
1278 var view = new Uint16List.view(array.asByteArray(), 2, 10); 1294 var view = new Uint16List.view(array.asByteArray(), 2, 10);
1279 Expect.isTrue(view is List<int>); 1295 Expect.isTrue(view is List<int>);
1280 Expect.isTrue(view is Uint16List); 1296 Expect.isTrue(view is Uint16List);
1281 Expect.equals(10, view.length); 1297 Expect.equals(10, view.length);
1282 Expect.equals(2, view.bytesPerElement()); 1298 Expect.equals(2, view.bytesPerElement());
1283 Expect.equals(20, view.lengthInBytes()); 1299 Expect.equals(20, view.lengthInBytes());
1284 Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 1300 Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
1285 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF], 1301 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF],
1286 view); 1302 view);
1287 Expect.throws(() { view[-1] = 0; }, 1303 Expect.throws(() { view[-1] = 0; },
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 (e) { return e is IndexOutOfRangeException; }); 1387 (e) { return e is IndexOutOfRangeException; });
1372 Expect.throws(() { new Int32List.view(array.asByteArray(), 1388 Expect.throws(() { new Int32List.view(array.asByteArray(),
1373 array.length); }, 1389 array.length); },
1374 (e) { return e is IndexOutOfRangeException; }); 1390 (e) { return e is IndexOutOfRangeException; });
1375 Expect.throws(() { new Int32List.view(array.asByteArray(), 1391 Expect.throws(() { new Int32List.view(array.asByteArray(),
1376 0, array.length + 1); }, 1392 0, array.length + 1); },
1377 (e) { return e is IndexOutOfRangeException; }); 1393 (e) { return e is IndexOutOfRangeException; });
1378 Expect.throws(() { new Int32List.view(array.asByteArray(), 1394 Expect.throws(() { new Int32List.view(array.asByteArray(),
1379 array.length - 1, 2); }, 1395 array.length - 1, 2); },
1380 (e) { return e is IndexOutOfRangeException; }); 1396 (e) { return e is IndexOutOfRangeException; });
1397 var whole = new Int32List.view(array.asByteArray());
1398 Expect.isTrue(whole is List<int>);
1399 Expect.isTrue(whole is Int32List);
1400 Expect.equals(12, whole.length);
1381 var view = new Int32List.view(array.asByteArray(), 4, 10); 1401 var view = new Int32List.view(array.asByteArray(), 4, 10);
1382 Expect.isTrue(view is List<int>); 1402 Expect.isTrue(view is List<int>);
1383 Expect.isTrue(view is Int32List); 1403 Expect.isTrue(view is Int32List);
1384 Expect.equals(10, view.length); 1404 Expect.equals(10, view.length);
1385 Expect.equals(4, view.bytesPerElement()); 1405 Expect.equals(4, view.bytesPerElement());
1386 Expect.equals(40, view.lengthInBytes()); 1406 Expect.equals(40, view.lengthInBytes());
1387 Expect.listEquals([-1, -1, -1, -1, -1, 1407 Expect.listEquals([-1, -1, -1, -1, -1,
1388 -1, -1, -1, -1, -1], 1408 -1, -1, -1, -1, -1],
1389 view); 1409 view);
1390 Expect.throws(() { view[-1] = 0; }, 1410 Expect.throws(() { view[-1] = 0; },
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 (e) { return e is IndexOutOfRangeException; }); 1541 (e) { return e is IndexOutOfRangeException; });
1522 Expect.throws(() { new Uint32List.view(array.asByteArray(), 1542 Expect.throws(() { new Uint32List.view(array.asByteArray(),
1523 array.length); }, 1543 array.length); },
1524 (e) { return e is IndexOutOfRangeException; }); 1544 (e) { return e is IndexOutOfRangeException; });
1525 Expect.throws(() { new Uint32List.view(array.asByteArray(), 1545 Expect.throws(() { new Uint32List.view(array.asByteArray(),
1526 0, array.length + 1); }, 1546 0, array.length + 1); },
1527 (e) { return e is IndexOutOfRangeException; }); 1547 (e) { return e is IndexOutOfRangeException; });
1528 Expect.throws(() { new Uint32List.view(array.asByteArray(), 1548 Expect.throws(() { new Uint32List.view(array.asByteArray(),
1529 array.length - 1, 2); }, 1549 array.length - 1, 2); },
1530 (e) { return e is IndexOutOfRangeException; }); 1550 (e) { return e is IndexOutOfRangeException; });
1551 var whole = new Uint32List.view(array.asByteArray());
1552 Expect.isTrue(whole is List<int>);
1553 Expect.isTrue(whole is Uint32List);
1554 Expect.equals(12, whole.length);
1531 var view = new Uint32List.view(array.asByteArray(), 4, 10); 1555 var view = new Uint32List.view(array.asByteArray(), 4, 10);
1532 Expect.isTrue(view is List<int>); 1556 Expect.isTrue(view is List<int>);
1533 Expect.isTrue(view is Uint32List); 1557 Expect.isTrue(view is Uint32List);
1534 Expect.equals(10, view.length); 1558 Expect.equals(10, view.length);
1535 Expect.equals(4, view.bytesPerElement()); 1559 Expect.equals(4, view.bytesPerElement());
1536 Expect.equals(40, view.lengthInBytes()); 1560 Expect.equals(40, view.lengthInBytes());
1537 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F, 1561 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F,
1538 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F], 1562 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF F],
1539 view); 1563 view);
1540 Expect.throws(() { view[-1] = 0; }, 1564 Expect.throws(() { view[-1] = 0; },
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 (e) { return e is IndexOutOfRangeException; }); 1665 (e) { return e is IndexOutOfRangeException; });
1642 Expect.throws(() { new Int64List.view(array.asByteArray(), 1666 Expect.throws(() { new Int64List.view(array.asByteArray(),
1643 array.length); }, 1667 array.length); },
1644 (e) { return e is IndexOutOfRangeException; }); 1668 (e) { return e is IndexOutOfRangeException; });
1645 Expect.throws(() { new Int64List.view(array.asByteArray(), 1669 Expect.throws(() { new Int64List.view(array.asByteArray(),
1646 0, array.length + 1); }, 1670 0, array.length + 1); },
1647 (e) { return e is IndexOutOfRangeException; }); 1671 (e) { return e is IndexOutOfRangeException; });
1648 Expect.throws(() { new Int64List.view(array.asByteArray(), 1672 Expect.throws(() { new Int64List.view(array.asByteArray(),
1649 array.length - 1, 2); }, 1673 array.length - 1, 2); },
1650 (e) { return e is IndexOutOfRangeException; }); 1674 (e) { return e is IndexOutOfRangeException; });
1675 var whole = new Int64List.view(array.asByteArray());
1676 Expect.isTrue(whole is List<int>);
1677 Expect.isTrue(whole is Int64List);
1678 Expect.equals(12, whole.length);
1651 var view = new Int64List.view(array.asByteArray(), 8, 10); 1679 var view = new Int64List.view(array.asByteArray(), 8, 10);
1652 Expect.isTrue(view is List<int>); 1680 Expect.isTrue(view is List<int>);
1653 Expect.isTrue(view is Int64List); 1681 Expect.isTrue(view is Int64List);
1654 Expect.equals(10, view.length); 1682 Expect.equals(10, view.length);
1655 Expect.equals(8, view.bytesPerElement()); 1683 Expect.equals(8, view.bytesPerElement());
1656 Expect.equals(80, view.lengthInBytes()); 1684 Expect.equals(80, view.lengthInBytes());
1657 Expect.listEquals([-1, -1, -1, -1, -1, 1685 Expect.listEquals([-1, -1, -1, -1, -1,
1658 -1, -1, -1, -1, -1], 1686 -1, -1, -1, -1, -1],
1659 view); 1687 view);
1660 Expect.throws(() { view[-1] = 0; }, 1688 Expect.throws(() { view[-1] = 0; },
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 (e) { return e is IndexOutOfRangeException; }); 1856 (e) { return e is IndexOutOfRangeException; });
1829 Expect.throws(() { new Uint64List.view(array.asByteArray(), 1857 Expect.throws(() { new Uint64List.view(array.asByteArray(),
1830 array.length); }, 1858 array.length); },
1831 (e) { return e is IndexOutOfRangeException; }); 1859 (e) { return e is IndexOutOfRangeException; });
1832 Expect.throws(() { new Uint64List.view(array.asByteArray(), 1860 Expect.throws(() { new Uint64List.view(array.asByteArray(),
1833 0, array.length + 1); }, 1861 0, array.length + 1); },
1834 (e) { return e is IndexOutOfRangeException; }); 1862 (e) { return e is IndexOutOfRangeException; });
1835 Expect.throws(() { new Uint64List.view(array.asByteArray(), 1863 Expect.throws(() { new Uint64List.view(array.asByteArray(),
1836 array.length - 1, 2); }, 1864 array.length - 1, 2); },
1837 (e) { return e is IndexOutOfRangeException; }); 1865 (e) { return e is IndexOutOfRangeException; });
1866 var whole = new Uint64List.view(array.asByteArray());
1867 Expect.isTrue(whole is List<int>);
1868 Expect.isTrue(whole is Uint64List);
1869 Expect.equals(12, whole.length);
1838 var view = new Uint64List.view(array.asByteArray(), 8, 10); 1870 var view = new Uint64List.view(array.asByteArray(), 8, 10);
1839 Expect.isTrue(view is List<int>); 1871 Expect.isTrue(view is List<int>);
1840 Expect.isTrue(view is Uint64List); 1872 Expect.isTrue(view is Uint64List);
1841 Expect.equals(10, view.length); 1873 Expect.equals(10, view.length);
1842 Expect.equals(8, view.bytesPerElement()); 1874 Expect.equals(8, view.bytesPerElement());
1843 Expect.equals(80, view.lengthInBytes()); 1875 Expect.equals(80, view.lengthInBytes());
1844 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1876 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1845 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1877 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1846 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1878 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
1847 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 1879 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 (e) { return e is IndexOutOfRangeException; }); 2008 (e) { return e is IndexOutOfRangeException; });
1977 Expect.throws(() { new Float32List.view(array.asByteArray(), 2009 Expect.throws(() { new Float32List.view(array.asByteArray(),
1978 array.lengthInBytes() + 1); }, 2010 array.lengthInBytes() + 1); },
1979 (e) { return e is IndexOutOfRangeException; }); 2011 (e) { return e is IndexOutOfRangeException; });
1980 Expect.throws(() { new Float32List.view(array.asByteArray(), 2012 Expect.throws(() { new Float32List.view(array.asByteArray(),
1981 0, array.lengthInBytes() + 1); }, 2013 0, array.lengthInBytes() + 1); },
1982 (e) { return e is IndexOutOfRangeException; }); 2014 (e) { return e is IndexOutOfRangeException; });
1983 Expect.throws(() { new Float32List.view(array.asByteArray(), 2015 Expect.throws(() { new Float32List.view(array.asByteArray(),
1984 array.lengthInBytes() - 1, 2); }, 2016 array.lengthInBytes() - 1, 2); },
1985 (e) { return e is IndexOutOfRangeException; }); 2017 (e) { return e is IndexOutOfRangeException; });
2018 var whole = new Float32List.view(array.asByteArray());
2019 Expect.isTrue(whole is List<double>);
2020 Expect.isTrue(whole is Float32List);
2021 Expect.equals(12, whole.length);
1986 var view = new Float32List.view(array.asByteArray(), 4, 10); 2022 var view = new Float32List.view(array.asByteArray(), 4, 10);
1987 Expect.isTrue(view is List<double>); 2023 Expect.isTrue(view is List<double>);
2024 Expect.isTrue(view is Float32List);
1988 Expect.equals(10, view.length); 2025 Expect.equals(10, view.length);
1989 Expect.equals(4, view.bytesPerElement()); 2026 Expect.equals(4, view.bytesPerElement());
1990 Expect.equals(40, view.lengthInBytes()); 2027 Expect.equals(40, view.lengthInBytes());
1991 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, 2028 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0,
1992 -1.0, -1.0, -1.0, -1.0, -1.0], 2029 -1.0, -1.0, -1.0, -1.0, -1.0],
1993 view); 2030 view);
1994 Expect.throws(() { view[-1] = 0.0; }, 2031 Expect.throws(() { view[-1] = 0.0; },
1995 (e) { return e is IndexOutOfRangeException; }); 2032 (e) { return e is IndexOutOfRangeException; });
1996 Expect.throws(() { return view[-1]; }, 2033 Expect.throws(() { return view[-1]; },
1997 (e) { return e is IndexOutOfRangeException; }); 2034 (e) { return e is IndexOutOfRangeException; });
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 (e) { return e is IndexOutOfRangeException; }); 2106 (e) { return e is IndexOutOfRangeException; });
2070 Expect.throws(() { new Float64List.view(array.asByteArray(), 2107 Expect.throws(() { new Float64List.view(array.asByteArray(),
2071 array.lengthInBytes() + 1); }, 2108 array.lengthInBytes() + 1); },
2072 (e) { return e is IndexOutOfRangeException; }); 2109 (e) { return e is IndexOutOfRangeException; });
2073 Expect.throws(() { new Float64List.view(array.asByteArray(), 2110 Expect.throws(() { new Float64List.view(array.asByteArray(),
2074 0, array.lengthInBytes() + 1); }, 2111 0, array.lengthInBytes() + 1); },
2075 (e) { return e is IndexOutOfRangeException; }); 2112 (e) { return e is IndexOutOfRangeException; });
2076 Expect.throws(() { new Float64List.view(array.asByteArray(), 2113 Expect.throws(() { new Float64List.view(array.asByteArray(),
2077 array.lengthInBytes() - 1, 2); }, 2114 array.lengthInBytes() - 1, 2); },
2078 (e) { return e is IndexOutOfRangeException; }); 2115 (e) { return e is IndexOutOfRangeException; });
2116 var whole = new Float64List.view(array.asByteArray());
2117 Expect.isTrue(whole is List<double>);
2118 Expect.isTrue(whole is Float64List);
2119 Expect.equals(12, whole.length);
2079 var view = new Float64List.view(array.asByteArray(), 8, 10); 2120 var view = new Float64List.view(array.asByteArray(), 8, 10);
2080 Expect.isTrue(view is List<double>); 2121 Expect.isTrue(view is List<double>);
2122 Expect.isTrue(view is Float64List);
2081 Expect.equals(10, view.length); 2123 Expect.equals(10, view.length);
2082 Expect.equals(8, view.bytesPerElement()); 2124 Expect.equals(8, view.bytesPerElement());
2083 Expect.equals(80, view.lengthInBytes()); 2125 Expect.equals(80, view.lengthInBytes());
2084 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, 2126 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0,
2085 -1.0, -1.0, -1.0, -1.0, -1.0], 2127 -1.0, -1.0, -1.0, -1.0, -1.0],
2086 view); 2128 view);
2087 Expect.throws(() { view[-1] = 0.0; }, 2129 Expect.throws(() { view[-1] = 0.0; },
2088 (e) { return e is IndexOutOfRangeException; }); 2130 (e) { return e is IndexOutOfRangeException; });
2089 Expect.throws(() { return view[-1]; }, 2131 Expect.throws(() { return view[-1]; },
2090 (e) { return e is IndexOutOfRangeException; }); 2132 (e) { return e is IndexOutOfRangeException; });
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 testInt64ListView(); 2210 testInt64ListView();
2169 testUint64ListView(); 2211 testUint64ListView();
2170 testFloat32ListView(); 2212 testFloat32ListView();
2171 testFloat64ListView(); 2213 testFloat64ListView();
2172 } 2214 }
2173 } 2215 }
2174 2216
2175 main() { 2217 main() {
2176 ByteArrayTest.testMain(); 2218 ByteArrayTest.testMain();
2177 } 2219 }
OLDNEW
« 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