OLD | NEW |
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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 Expect.equals(1, array.bytesPerElement()); | 917 Expect.equals(1, array.bytesPerElement()); |
918 Expect.equals(12, array.lengthInBytes()); | 918 Expect.equals(12, array.lengthInBytes()); |
919 for (int i = 0; i < array.length; ++i) { | 919 for (int i = 0; i < array.length; ++i) { |
920 array[i] = 0xFF; | 920 array[i] = 0xFF; |
921 } | 921 } |
922 Expect.throws(() { new Int8List.view(array.asByteArray(), -1); }, | 922 Expect.throws(() { new Int8List.view(array.asByteArray(), -1); }, |
923 (e) { return e is IndexOutOfRangeException; }); | 923 (e) { return e is IndexOutOfRangeException; }); |
924 Expect.throws(() { new Int8List.view(array.asByteArray(), 0, -1); }, | 924 Expect.throws(() { new Int8List.view(array.asByteArray(), 0, -1); }, |
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.lengthInBytes() + 1); }, |
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 empty = new Int8List.view(array.asByteArray(), |
| 936 array.lengthInBytes()); |
| 937 Expect.isTrue(empty is List<int>); |
| 938 Expect.isTrue(empty is Int8List); |
| 939 Expect.equals(0, empty.length); |
| 940 var whole = new Int8List.view(array.asByteArray()); |
| 941 Expect.isTrue(whole is List<int>); |
| 942 Expect.isTrue(whole is Int8List); |
| 943 Expect.equals(12, whole.length); |
935 var view = new Int8List.view(array.asByteArray(), 1, array.length - 2); | 944 var view = new Int8List.view(array.asByteArray(), 1, array.length - 2); |
936 Expect.isTrue(view is List<int>); | 945 Expect.isTrue(view is List<int>); |
937 Expect.isTrue(view is Int8List); | 946 Expect.isTrue(view is Int8List); |
938 Expect.equals(10, view.length); | 947 Expect.equals(10, view.length); |
939 Expect.equals(1, view.bytesPerElement()); | 948 Expect.equals(1, view.bytesPerElement()); |
940 Expect.equals(10, view.lengthInBytes()); | 949 Expect.equals(10, view.lengthInBytes()); |
941 Expect.listEquals([-1, -1, -1, -1, -1, | 950 Expect.listEquals([-1, -1, -1, -1, -1, |
942 -1, -1, -1, -1, -1], | 951 -1, -1, -1, -1, -1], |
943 view); | 952 view); |
944 Expect.throws(() { view[-1] = 0; }, | 953 Expect.throws(() { view[-1] = 0; }, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 Expect.equals(1, array.bytesPerElement()); | 1045 Expect.equals(1, array.bytesPerElement()); |
1037 Expect.equals(12, array.lengthInBytes()); | 1046 Expect.equals(12, array.lengthInBytes()); |
1038 for (int i = 0; i < array.length; ++i) { | 1047 for (int i = 0; i < array.length; ++i) { |
1039 array[i] = -1; | 1048 array[i] = -1; |
1040 } | 1049 } |
1041 Expect.throws(() { new Uint8List.view(array.asByteArray(), -1); }, | 1050 Expect.throws(() { new Uint8List.view(array.asByteArray(), -1); }, |
1042 (e) { return e is IndexOutOfRangeException; }); | 1051 (e) { return e is IndexOutOfRangeException; }); |
1043 Expect.throws(() { new Uint8List.view(array.asByteArray(), 0, -1); }, | 1052 Expect.throws(() { new Uint8List.view(array.asByteArray(), 0, -1); }, |
1044 (e) { return e is IndexOutOfRangeException; }); | 1053 (e) { return e is IndexOutOfRangeException; }); |
1045 Expect.throws(() { new Uint8List.view(array.asByteArray(), | 1054 Expect.throws(() { new Uint8List.view(array.asByteArray(), |
1046 array.length); }, | 1055 array.lengthInBytes() + 1); }, |
1047 (e) { return e is IndexOutOfRangeException; }); | 1056 (e) { return e is IndexOutOfRangeException; }); |
1048 Expect.throws(() { new Uint8List.view(array.asByteArray(), | 1057 Expect.throws(() { new Uint8List.view(array.asByteArray(), |
1049 0, array.length + 1); }, | 1058 0, array.length + 1); }, |
1050 (e) { return e is IndexOutOfRangeException; }); | 1059 (e) { return e is IndexOutOfRangeException; }); |
1051 Expect.throws(() { new Uint8List.view(array.asByteArray(), | 1060 Expect.throws(() { new Uint8List.view(array.asByteArray(), |
1052 array.length - 1, 2); }, | 1061 array.length - 1, 2); }, |
1053 (e) { return e is IndexOutOfRangeException; }); | 1062 (e) { return e is IndexOutOfRangeException; }); |
| 1063 var empty = new Uint8List.view(array.asByteArray(), |
| 1064 array.lengthInBytes()); |
| 1065 Expect.isTrue(empty is List<int>); |
| 1066 Expect.isTrue(empty is Uint8List); |
| 1067 Expect.equals(0, empty.length); |
| 1068 var whole = new Uint8List.view(array.asByteArray()); |
| 1069 Expect.isTrue(whole is List<int>); |
| 1070 Expect.isTrue(whole is Uint8List); |
| 1071 Expect.equals(12, whole.length); |
1054 var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2); | 1072 var view = new Uint8List.view(array.asByteArray(), 1, array.length - 2); |
1055 Expect.isTrue(view is List<int>); | 1073 Expect.isTrue(view is List<int>); |
1056 Expect.isTrue(view is Uint8List); | 1074 Expect.isTrue(view is Uint8List); |
1057 Expect.equals(10, view.length); | 1075 Expect.equals(10, view.length); |
1058 Expect.equals(1, view.bytesPerElement()); | 1076 Expect.equals(1, view.bytesPerElement()); |
1059 Expect.equals(10, view.lengthInBytes()); | 1077 Expect.equals(10, view.lengthInBytes()); |
1060 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | 1078 Expect.listEquals([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
1061 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], | 1079 0xFF, 0xFF, 0xFF, 0xFF, 0xFF], |
1062 view); | 1080 view); |
1063 Expect.throws(() { view[-1] = 0; }, | 1081 Expect.throws(() { view[-1] = 0; }, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 Expect.equals(1, array.bytesPerElement()); | 1152 Expect.equals(1, array.bytesPerElement()); |
1135 Expect.equals(24, array.lengthInBytes()); | 1153 Expect.equals(24, array.lengthInBytes()); |
1136 for (int i = 0; i < array.length; ++i) { | 1154 for (int i = 0; i < array.length; ++i) { |
1137 array[i] = 0xFF; | 1155 array[i] = 0xFF; |
1138 } | 1156 } |
1139 Expect.throws(() { new Int16List.view(array.asByteArray(), -1); }, | 1157 Expect.throws(() { new Int16List.view(array.asByteArray(), -1); }, |
1140 (e) { return e is IndexOutOfRangeException; }); | 1158 (e) { return e is IndexOutOfRangeException; }); |
1141 Expect.throws(() { new Int16List.view(array.asByteArray(), 0, -1); }, | 1159 Expect.throws(() { new Int16List.view(array.asByteArray(), 0, -1); }, |
1142 (e) { return e is IndexOutOfRangeException; }); | 1160 (e) { return e is IndexOutOfRangeException; }); |
1143 Expect.throws(() { new Int16List.view(array.asByteArray(), | 1161 Expect.throws(() { new Int16List.view(array.asByteArray(), |
1144 array.length); }, | 1162 array.lengthInBytes() + 1); }, |
1145 (e) { return e is IndexOutOfRangeException; }); | 1163 (e) { return e is IndexOutOfRangeException; }); |
1146 Expect.throws(() { new Int16List.view(array.asByteArray(), | 1164 Expect.throws(() { new Int16List.view(array.asByteArray(), |
1147 0, array.length + 1); }, | 1165 0, array.length + 1); }, |
1148 (e) { return e is IndexOutOfRangeException; }); | 1166 (e) { return e is IndexOutOfRangeException; }); |
1149 Expect.throws(() { new Int16List.view(array.asByteArray(), | 1167 Expect.throws(() { new Int16List.view(array.asByteArray(), |
1150 array.length - 1, 2); }, | 1168 array.length - 1, 2); }, |
1151 (e) { return e is IndexOutOfRangeException; }); | 1169 (e) { return e is IndexOutOfRangeException; }); |
| 1170 var empty = new Int16List.view(array.asByteArray(), |
| 1171 array.lengthInBytes()); |
| 1172 Expect.isTrue(empty is List<int>); |
| 1173 Expect.isTrue(empty is Int16List); |
| 1174 Expect.equals(0, empty.length); |
| 1175 var whole = new Int16List.view(array.asByteArray()); |
| 1176 Expect.isTrue(whole is List<int>); |
| 1177 Expect.isTrue(whole is Int16List); |
| 1178 Expect.equals(12, whole.length); |
1152 var view = new Int16List.view(array.asByteArray(), 2, 10); | 1179 var view = new Int16List.view(array.asByteArray(), 2, 10); |
1153 Expect.isTrue(view is List<int>); | 1180 Expect.isTrue(view is List<int>); |
1154 Expect.isTrue(view is Int16List); | 1181 Expect.isTrue(view is Int16List); |
1155 Expect.equals(10, view.length); | 1182 Expect.equals(10, view.length); |
1156 Expect.equals(2, view.bytesPerElement()); | 1183 Expect.equals(2, view.bytesPerElement()); |
1157 Expect.equals(20, view.lengthInBytes()); | 1184 Expect.equals(20, view.lengthInBytes()); |
1158 Expect.listEquals([-1, -1, -1, -1, -1, | 1185 Expect.listEquals([-1, -1, -1, -1, -1, |
1159 -1, -1, -1, -1, -1], | 1186 -1, -1, -1, -1, -1], |
1160 view); | 1187 view); |
1161 Expect.throws(() { view[-1] = 0; }, | 1188 Expect.throws(() { view[-1] = 0; }, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 Expect.equals(1, array.bytesPerElement()); | 1287 Expect.equals(1, array.bytesPerElement()); |
1261 Expect.equals(24, array.lengthInBytes()); | 1288 Expect.equals(24, array.lengthInBytes()); |
1262 for (int i = 0; i < array.length; ++i) { | 1289 for (int i = 0; i < array.length; ++i) { |
1263 array[i] = -1; | 1290 array[i] = -1; |
1264 } | 1291 } |
1265 Expect.throws(() { new Uint16List.view(array.asByteArray(), -1); }, | 1292 Expect.throws(() { new Uint16List.view(array.asByteArray(), -1); }, |
1266 (e) { return e is IndexOutOfRangeException; }); | 1293 (e) { return e is IndexOutOfRangeException; }); |
1267 Expect.throws(() { new Uint16List.view(array.asByteArray(), 0, -1); }, | 1294 Expect.throws(() { new Uint16List.view(array.asByteArray(), 0, -1); }, |
1268 (e) { return e is IndexOutOfRangeException; }); | 1295 (e) { return e is IndexOutOfRangeException; }); |
1269 Expect.throws(() { new Uint16List.view(array.asByteArray(), | 1296 Expect.throws(() { new Uint16List.view(array.asByteArray(), |
1270 array.length); }, | 1297 array.lengthInBytes() + 1); }, |
1271 (e) { return e is IndexOutOfRangeException; }); | 1298 (e) { return e is IndexOutOfRangeException; }); |
1272 Expect.throws(() { new Uint16List.view(array.asByteArray(), | 1299 Expect.throws(() { new Uint16List.view(array.asByteArray(), |
1273 0, array.length + 1); }, | 1300 0, array.length + 1); }, |
1274 (e) { return e is IndexOutOfRangeException; }); | 1301 (e) { return e is IndexOutOfRangeException; }); |
1275 Expect.throws(() { new Uint16List.view(array.asByteArray(), | 1302 Expect.throws(() { new Uint16List.view(array.asByteArray(), |
1276 array.length - 1, 2); }, | 1303 array.length - 1, 2); }, |
1277 (e) { return e is IndexOutOfRangeException; }); | 1304 (e) { return e is IndexOutOfRangeException; }); |
| 1305 var empty = new Uint16List.view(array.asByteArray(), |
| 1306 array.lengthInBytes()); |
| 1307 Expect.isTrue(empty is List<int>); |
| 1308 Expect.isTrue(empty is Uint16List); |
| 1309 Expect.equals(0, empty.length); |
| 1310 var whole = new Uint16List.view(array.asByteArray()); |
| 1311 Expect.isTrue(whole is List<int>); |
| 1312 Expect.isTrue(whole is Uint16List); |
| 1313 Expect.equals(12, whole.length); |
1278 var view = new Uint16List.view(array.asByteArray(), 2, 10); | 1314 var view = new Uint16List.view(array.asByteArray(), 2, 10); |
1279 Expect.isTrue(view is List<int>); | 1315 Expect.isTrue(view is List<int>); |
1280 Expect.isTrue(view is Uint16List); | 1316 Expect.isTrue(view is Uint16List); |
1281 Expect.equals(10, view.length); | 1317 Expect.equals(10, view.length); |
1282 Expect.equals(2, view.bytesPerElement()); | 1318 Expect.equals(2, view.bytesPerElement()); |
1283 Expect.equals(20, view.lengthInBytes()); | 1319 Expect.equals(20, view.lengthInBytes()); |
1284 Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | 1320 Expect.listEquals([0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
1285 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF], | 1321 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF], |
1286 view); | 1322 view); |
1287 Expect.throws(() { view[-1] = 0; }, | 1323 Expect.throws(() { view[-1] = 0; }, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 Expect.equals(1, array.bytesPerElement()); | 1399 Expect.equals(1, array.bytesPerElement()); |
1364 Expect.equals(48, array.lengthInBytes()); | 1400 Expect.equals(48, array.lengthInBytes()); |
1365 for (int i = 0; i < array.length; ++i) { | 1401 for (int i = 0; i < array.length; ++i) { |
1366 array[i] = 0xFF; | 1402 array[i] = 0xFF; |
1367 } | 1403 } |
1368 Expect.throws(() { new Int32List.view(array.asByteArray(), -1); }, | 1404 Expect.throws(() { new Int32List.view(array.asByteArray(), -1); }, |
1369 (e) { return e is IndexOutOfRangeException; }); | 1405 (e) { return e is IndexOutOfRangeException; }); |
1370 Expect.throws(() { new Int32List.view(array.asByteArray(), 0, -1); }, | 1406 Expect.throws(() { new Int32List.view(array.asByteArray(), 0, -1); }, |
1371 (e) { return e is IndexOutOfRangeException; }); | 1407 (e) { return e is IndexOutOfRangeException; }); |
1372 Expect.throws(() { new Int32List.view(array.asByteArray(), | 1408 Expect.throws(() { new Int32List.view(array.asByteArray(), |
1373 array.length); }, | 1409 array.lengthInBytes() + 1); }, |
1374 (e) { return e is IndexOutOfRangeException; }); | 1410 (e) { return e is IndexOutOfRangeException; }); |
1375 Expect.throws(() { new Int32List.view(array.asByteArray(), | 1411 Expect.throws(() { new Int32List.view(array.asByteArray(), |
1376 0, array.length + 1); }, | 1412 0, array.length + 1); }, |
1377 (e) { return e is IndexOutOfRangeException; }); | 1413 (e) { return e is IndexOutOfRangeException; }); |
1378 Expect.throws(() { new Int32List.view(array.asByteArray(), | 1414 Expect.throws(() { new Int32List.view(array.asByteArray(), |
1379 array.length - 1, 2); }, | 1415 array.length - 1, 2); }, |
1380 (e) { return e is IndexOutOfRangeException; }); | 1416 (e) { return e is IndexOutOfRangeException; }); |
| 1417 var empty = new Int32List.view(array.asByteArray(), |
| 1418 array.lengthInBytes()); |
| 1419 Expect.isTrue(empty is List<int>); |
| 1420 Expect.isTrue(empty is Int32List); |
| 1421 Expect.equals(0, empty.length); |
| 1422 var whole = new Int32List.view(array.asByteArray()); |
| 1423 Expect.isTrue(whole is List<int>); |
| 1424 Expect.isTrue(whole is Int32List); |
| 1425 Expect.equals(12, whole.length); |
1381 var view = new Int32List.view(array.asByteArray(), 4, 10); | 1426 var view = new Int32List.view(array.asByteArray(), 4, 10); |
1382 Expect.isTrue(view is List<int>); | 1427 Expect.isTrue(view is List<int>); |
1383 Expect.isTrue(view is Int32List); | 1428 Expect.isTrue(view is Int32List); |
1384 Expect.equals(10, view.length); | 1429 Expect.equals(10, view.length); |
1385 Expect.equals(4, view.bytesPerElement()); | 1430 Expect.equals(4, view.bytesPerElement()); |
1386 Expect.equals(40, view.lengthInBytes()); | 1431 Expect.equals(40, view.lengthInBytes()); |
1387 Expect.listEquals([-1, -1, -1, -1, -1, | 1432 Expect.listEquals([-1, -1, -1, -1, -1, |
1388 -1, -1, -1, -1, -1], | 1433 -1, -1, -1, -1, -1], |
1389 view); | 1434 view); |
1390 Expect.throws(() { view[-1] = 0; }, | 1435 Expect.throws(() { view[-1] = 0; }, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 Expect.equals(1, array.bytesPerElement()); | 1558 Expect.equals(1, array.bytesPerElement()); |
1514 Expect.equals(48, array.lengthInBytes()); | 1559 Expect.equals(48, array.lengthInBytes()); |
1515 for (int i = 0; i < array.length; ++i) { | 1560 for (int i = 0; i < array.length; ++i) { |
1516 array[i] = -1; | 1561 array[i] = -1; |
1517 } | 1562 } |
1518 Expect.throws(() { new Uint32List.view(array.asByteArray(), -1); }, | 1563 Expect.throws(() { new Uint32List.view(array.asByteArray(), -1); }, |
1519 (e) { return e is IndexOutOfRangeException; }); | 1564 (e) { return e is IndexOutOfRangeException; }); |
1520 Expect.throws(() { new Uint32List.view(array.asByteArray(), 0, -1); }, | 1565 Expect.throws(() { new Uint32List.view(array.asByteArray(), 0, -1); }, |
1521 (e) { return e is IndexOutOfRangeException; }); | 1566 (e) { return e is IndexOutOfRangeException; }); |
1522 Expect.throws(() { new Uint32List.view(array.asByteArray(), | 1567 Expect.throws(() { new Uint32List.view(array.asByteArray(), |
1523 array.length); }, | 1568 array.lengthInBytes() + 1); }, |
1524 (e) { return e is IndexOutOfRangeException; }); | 1569 (e) { return e is IndexOutOfRangeException; }); |
1525 Expect.throws(() { new Uint32List.view(array.asByteArray(), | 1570 Expect.throws(() { new Uint32List.view(array.asByteArray(), |
1526 0, array.length + 1); }, | 1571 0, array.length + 1); }, |
1527 (e) { return e is IndexOutOfRangeException; }); | 1572 (e) { return e is IndexOutOfRangeException; }); |
1528 Expect.throws(() { new Uint32List.view(array.asByteArray(), | 1573 Expect.throws(() { new Uint32List.view(array.asByteArray(), |
1529 array.length - 1, 2); }, | 1574 array.length - 1, 2); }, |
1530 (e) { return e is IndexOutOfRangeException; }); | 1575 (e) { return e is IndexOutOfRangeException; }); |
| 1576 var empty = new Uint32List.view(array.asByteArray(), |
| 1577 array.lengthInBytes()); |
| 1578 Expect.isTrue(empty is List<int>); |
| 1579 Expect.isTrue(empty is Uint32List); |
| 1580 Expect.equals(0, empty.length); |
| 1581 var whole = new Uint32List.view(array.asByteArray()); |
| 1582 Expect.isTrue(whole is List<int>); |
| 1583 Expect.isTrue(whole is Uint32List); |
| 1584 Expect.equals(12, whole.length); |
1531 var view = new Uint32List.view(array.asByteArray(), 4, 10); | 1585 var view = new Uint32List.view(array.asByteArray(), 4, 10); |
1532 Expect.isTrue(view is List<int>); | 1586 Expect.isTrue(view is List<int>); |
1533 Expect.isTrue(view is Uint32List); | 1587 Expect.isTrue(view is Uint32List); |
1534 Expect.equals(10, view.length); | 1588 Expect.equals(10, view.length); |
1535 Expect.equals(4, view.bytesPerElement()); | 1589 Expect.equals(4, view.bytesPerElement()); |
1536 Expect.equals(40, view.lengthInBytes()); | 1590 Expect.equals(40, view.lengthInBytes()); |
1537 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF
F, | 1591 Expect.listEquals([0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF
F, |
1538 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF
F], | 1592 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFF
F], |
1539 view); | 1593 view); |
1540 Expect.throws(() { view[-1] = 0; }, | 1594 Expect.throws(() { view[-1] = 0; }, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 Expect.equals(1, array.bytesPerElement()); | 1687 Expect.equals(1, array.bytesPerElement()); |
1634 Expect.equals(96, array.lengthInBytes()); | 1688 Expect.equals(96, array.lengthInBytes()); |
1635 for (int i = 0; i < array.length; ++i) { | 1689 for (int i = 0; i < array.length; ++i) { |
1636 array[i] = 0xFF; | 1690 array[i] = 0xFF; |
1637 } | 1691 } |
1638 Expect.throws(() { new Int64List.view(array.asByteArray(), -1); }, | 1692 Expect.throws(() { new Int64List.view(array.asByteArray(), -1); }, |
1639 (e) { return e is IndexOutOfRangeException; }); | 1693 (e) { return e is IndexOutOfRangeException; }); |
1640 Expect.throws(() { new Int64List.view(array.asByteArray(), 0, -1); }, | 1694 Expect.throws(() { new Int64List.view(array.asByteArray(), 0, -1); }, |
1641 (e) { return e is IndexOutOfRangeException; }); | 1695 (e) { return e is IndexOutOfRangeException; }); |
1642 Expect.throws(() { new Int64List.view(array.asByteArray(), | 1696 Expect.throws(() { new Int64List.view(array.asByteArray(), |
1643 array.length); }, | 1697 array.lengthInBytes() + 1); }, |
1644 (e) { return e is IndexOutOfRangeException; }); | 1698 (e) { return e is IndexOutOfRangeException; }); |
1645 Expect.throws(() { new Int64List.view(array.asByteArray(), | 1699 Expect.throws(() { new Int64List.view(array.asByteArray(), |
1646 0, array.length + 1); }, | 1700 0, array.length + 1); }, |
1647 (e) { return e is IndexOutOfRangeException; }); | 1701 (e) { return e is IndexOutOfRangeException; }); |
1648 Expect.throws(() { new Int64List.view(array.asByteArray(), | 1702 Expect.throws(() { new Int64List.view(array.asByteArray(), |
1649 array.length - 1, 2); }, | 1703 array.length - 1, 2); }, |
1650 (e) { return e is IndexOutOfRangeException; }); | 1704 (e) { return e is IndexOutOfRangeException; }); |
| 1705 var empty = new Int64List.view(array.asByteArray(), |
| 1706 array.lengthInBytes()); |
| 1707 Expect.isTrue(empty is List<int>); |
| 1708 Expect.isTrue(empty is Int64List); |
| 1709 Expect.equals(0, empty.length); |
| 1710 var whole = new Int64List.view(array.asByteArray()); |
| 1711 Expect.isTrue(whole is List<int>); |
| 1712 Expect.isTrue(whole is Int64List); |
| 1713 Expect.equals(12, whole.length); |
1651 var view = new Int64List.view(array.asByteArray(), 8, 10); | 1714 var view = new Int64List.view(array.asByteArray(), 8, 10); |
1652 Expect.isTrue(view is List<int>); | 1715 Expect.isTrue(view is List<int>); |
1653 Expect.isTrue(view is Int64List); | 1716 Expect.isTrue(view is Int64List); |
1654 Expect.equals(10, view.length); | 1717 Expect.equals(10, view.length); |
1655 Expect.equals(8, view.bytesPerElement()); | 1718 Expect.equals(8, view.bytesPerElement()); |
1656 Expect.equals(80, view.lengthInBytes()); | 1719 Expect.equals(80, view.lengthInBytes()); |
1657 Expect.listEquals([-1, -1, -1, -1, -1, | 1720 Expect.listEquals([-1, -1, -1, -1, -1, |
1658 -1, -1, -1, -1, -1], | 1721 -1, -1, -1, -1, -1], |
1659 view); | 1722 view); |
1660 Expect.throws(() { view[-1] = 0; }, | 1723 Expect.throws(() { view[-1] = 0; }, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 Expect.equals(1, array.bytesPerElement()); | 1883 Expect.equals(1, array.bytesPerElement()); |
1821 Expect.equals(96, array.lengthInBytes()); | 1884 Expect.equals(96, array.lengthInBytes()); |
1822 for (int i = 0; i < array.length; ++i) { | 1885 for (int i = 0; i < array.length; ++i) { |
1823 array[i] = -1; | 1886 array[i] = -1; |
1824 } | 1887 } |
1825 Expect.throws(() { new Uint64List.view(array.asByteArray(), -1); }, | 1888 Expect.throws(() { new Uint64List.view(array.asByteArray(), -1); }, |
1826 (e) { return e is IndexOutOfRangeException; }); | 1889 (e) { return e is IndexOutOfRangeException; }); |
1827 Expect.throws(() { new Uint64List.view(array.asByteArray(), 0, -1); }, | 1890 Expect.throws(() { new Uint64List.view(array.asByteArray(), 0, -1); }, |
1828 (e) { return e is IndexOutOfRangeException; }); | 1891 (e) { return e is IndexOutOfRangeException; }); |
1829 Expect.throws(() { new Uint64List.view(array.asByteArray(), | 1892 Expect.throws(() { new Uint64List.view(array.asByteArray(), |
1830 array.length); }, | 1893 array.lengthInBytes() + 1); }, |
1831 (e) { return e is IndexOutOfRangeException; }); | 1894 (e) { return e is IndexOutOfRangeException; }); |
1832 Expect.throws(() { new Uint64List.view(array.asByteArray(), | 1895 Expect.throws(() { new Uint64List.view(array.asByteArray(), |
1833 0, array.length + 1); }, | 1896 0, array.length + 1); }, |
1834 (e) { return e is IndexOutOfRangeException; }); | 1897 (e) { return e is IndexOutOfRangeException; }); |
1835 Expect.throws(() { new Uint64List.view(array.asByteArray(), | 1898 Expect.throws(() { new Uint64List.view(array.asByteArray(), |
1836 array.length - 1, 2); }, | 1899 array.length - 1, 2); }, |
1837 (e) { return e is IndexOutOfRangeException; }); | 1900 (e) { return e is IndexOutOfRangeException; }); |
| 1901 var empty = new Uint64List.view(array.asByteArray(), |
| 1902 array.lengthInBytes()); |
| 1903 Expect.isTrue(empty is List<int>); |
| 1904 Expect.isTrue(empty is Uint64List); |
| 1905 Expect.equals(0, empty.length); |
| 1906 var whole = new Uint64List.view(array.asByteArray()); |
| 1907 Expect.isTrue(whole is List<int>); |
| 1908 Expect.isTrue(whole is Uint64List); |
| 1909 Expect.equals(12, whole.length); |
1838 var view = new Uint64List.view(array.asByteArray(), 8, 10); | 1910 var view = new Uint64List.view(array.asByteArray(), 8, 10); |
1839 Expect.isTrue(view is List<int>); | 1911 Expect.isTrue(view is List<int>); |
1840 Expect.isTrue(view is Uint64List); | 1912 Expect.isTrue(view is Uint64List); |
1841 Expect.equals(10, view.length); | 1913 Expect.equals(10, view.length); |
1842 Expect.equals(8, view.bytesPerElement()); | 1914 Expect.equals(8, view.bytesPerElement()); |
1843 Expect.equals(80, view.lengthInBytes()); | 1915 Expect.equals(80, view.lengthInBytes()); |
1844 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, | 1916 Expect.listEquals([0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, |
1845 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, | 1917 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, |
1846 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, | 1918 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, |
1847 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, | 1919 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 Expect.equals(4, array.bytesPerElement()); | 2040 Expect.equals(4, array.bytesPerElement()); |
1969 Expect.equals(48, array.lengthInBytes()); | 2041 Expect.equals(48, array.lengthInBytes()); |
1970 for (int i = 0; i < array.length; ++i) { | 2042 for (int i = 0; i < array.length; ++i) { |
1971 array[i] = 0xBF800000; | 2043 array[i] = 0xBF800000; |
1972 } | 2044 } |
1973 Expect.throws(() { new Float32List.view(array.asByteArray(), -1); }, | 2045 Expect.throws(() { new Float32List.view(array.asByteArray(), -1); }, |
1974 (e) { return e is IndexOutOfRangeException; }); | 2046 (e) { return e is IndexOutOfRangeException; }); |
1975 Expect.throws(() { new Float32List.view(array.asByteArray(), 0, -1); }, | 2047 Expect.throws(() { new Float32List.view(array.asByteArray(), 0, -1); }, |
1976 (e) { return e is IndexOutOfRangeException; }); | 2048 (e) { return e is IndexOutOfRangeException; }); |
1977 Expect.throws(() { new Float32List.view(array.asByteArray(), | 2049 Expect.throws(() { new Float32List.view(array.asByteArray(), |
1978 array.lengthInBytes() + 1); }, | 2050 array.lengthInBytes() + 1); }, |
1979 (e) { return e is IndexOutOfRangeException; }); | 2051 (e) { return e is IndexOutOfRangeException; }); |
1980 Expect.throws(() { new Float32List.view(array.asByteArray(), | 2052 Expect.throws(() { new Float32List.view(array.asByteArray(), |
1981 0, array.lengthInBytes() + 1); }, | 2053 0, array.lengthInBytes() + 1); }, |
1982 (e) { return e is IndexOutOfRangeException; }); | 2054 (e) { return e is IndexOutOfRangeException; }); |
1983 Expect.throws(() { new Float32List.view(array.asByteArray(), | 2055 Expect.throws(() { new Float32List.view(array.asByteArray(), |
1984 array.lengthInBytes() - 1, 2); }, | 2056 array.lengthInBytes() - 1, 2); }, |
1985 (e) { return e is IndexOutOfRangeException; }); | 2057 (e) { return e is IndexOutOfRangeException; }); |
| 2058 var empty = new Float32List.view(array.asByteArray(), |
| 2059 array.lengthInBytes()); |
| 2060 Expect.isTrue(empty is List<double>); |
| 2061 Expect.isTrue(empty is Float32List); |
| 2062 Expect.equals(0, empty.length); |
| 2063 var whole = new Float32List.view(array.asByteArray()); |
| 2064 Expect.isTrue(whole is List<double>); |
| 2065 Expect.isTrue(whole is Float32List); |
| 2066 Expect.equals(12, whole.length); |
1986 var view = new Float32List.view(array.asByteArray(), 4, 10); | 2067 var view = new Float32List.view(array.asByteArray(), 4, 10); |
1987 Expect.isTrue(view is List<double>); | 2068 Expect.isTrue(view is List<double>); |
| 2069 Expect.isTrue(view is Float32List); |
1988 Expect.equals(10, view.length); | 2070 Expect.equals(10, view.length); |
1989 Expect.equals(4, view.bytesPerElement()); | 2071 Expect.equals(4, view.bytesPerElement()); |
1990 Expect.equals(40, view.lengthInBytes()); | 2072 Expect.equals(40, view.lengthInBytes()); |
1991 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, | 2073 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, |
1992 -1.0, -1.0, -1.0, -1.0, -1.0], | 2074 -1.0, -1.0, -1.0, -1.0, -1.0], |
1993 view); | 2075 view); |
1994 Expect.throws(() { view[-1] = 0.0; }, | 2076 Expect.throws(() { view[-1] = 0.0; }, |
1995 (e) { return e is IndexOutOfRangeException; }); | 2077 (e) { return e is IndexOutOfRangeException; }); |
1996 Expect.throws(() { return view[-1]; }, | 2078 Expect.throws(() { return view[-1]; }, |
1997 (e) { return e is IndexOutOfRangeException; }); | 2079 (e) { return e is IndexOutOfRangeException; }); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 Expect.equals(8, array.bytesPerElement()); | 2143 Expect.equals(8, array.bytesPerElement()); |
2062 Expect.equals(96, array.lengthInBytes()); | 2144 Expect.equals(96, array.lengthInBytes()); |
2063 for (int i = 0; i < array.length; ++i) { | 2145 for (int i = 0; i < array.length; ++i) { |
2064 array[i] = 0xBFF0000000000000; | 2146 array[i] = 0xBFF0000000000000; |
2065 } | 2147 } |
2066 Expect.throws(() { new Float64List.view(array.asByteArray(), -1); }, | 2148 Expect.throws(() { new Float64List.view(array.asByteArray(), -1); }, |
2067 (e) { return e is IndexOutOfRangeException; }); | 2149 (e) { return e is IndexOutOfRangeException; }); |
2068 Expect.throws(() { new Float64List.view(array.asByteArray(), 0, -1); }, | 2150 Expect.throws(() { new Float64List.view(array.asByteArray(), 0, -1); }, |
2069 (e) { return e is IndexOutOfRangeException; }); | 2151 (e) { return e is IndexOutOfRangeException; }); |
2070 Expect.throws(() { new Float64List.view(array.asByteArray(), | 2152 Expect.throws(() { new Float64List.view(array.asByteArray(), |
2071 array.lengthInBytes() + 1); }, | 2153 array.lengthInBytes() + 1); }, |
2072 (e) { return e is IndexOutOfRangeException; }); | 2154 (e) { return e is IndexOutOfRangeException; }); |
2073 Expect.throws(() { new Float64List.view(array.asByteArray(), | 2155 Expect.throws(() { new Float64List.view(array.asByteArray(), |
2074 0, array.lengthInBytes() + 1); }, | 2156 0, array.lengthInBytes() + 1); }, |
2075 (e) { return e is IndexOutOfRangeException; }); | 2157 (e) { return e is IndexOutOfRangeException; }); |
2076 Expect.throws(() { new Float64List.view(array.asByteArray(), | 2158 Expect.throws(() { new Float64List.view(array.asByteArray(), |
2077 array.lengthInBytes() - 1, 2); }, | 2159 array.lengthInBytes() - 1, 2); }, |
2078 (e) { return e is IndexOutOfRangeException; }); | 2160 (e) { return e is IndexOutOfRangeException; }); |
| 2161 var empty = new Float64List.view(array.asByteArray(), |
| 2162 array.lengthInBytes()); |
| 2163 Expect.isTrue(empty is List<double>); |
| 2164 Expect.isTrue(empty is Float64List); |
| 2165 Expect.equals(0, empty.length); |
| 2166 var whole = new Float64List.view(array.asByteArray()); |
| 2167 Expect.isTrue(whole is List<double>); |
| 2168 Expect.isTrue(whole is Float64List); |
| 2169 Expect.equals(12, whole.length); |
2079 var view = new Float64List.view(array.asByteArray(), 8, 10); | 2170 var view = new Float64List.view(array.asByteArray(), 8, 10); |
2080 Expect.isTrue(view is List<double>); | 2171 Expect.isTrue(view is List<double>); |
| 2172 Expect.isTrue(view is Float64List); |
2081 Expect.equals(10, view.length); | 2173 Expect.equals(10, view.length); |
2082 Expect.equals(8, view.bytesPerElement()); | 2174 Expect.equals(8, view.bytesPerElement()); |
2083 Expect.equals(80, view.lengthInBytes()); | 2175 Expect.equals(80, view.lengthInBytes()); |
2084 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, | 2176 Expect.listEquals([-1.0, -1.0, -1.0, -1.0, -1.0, |
2085 -1.0, -1.0, -1.0, -1.0, -1.0], | 2177 -1.0, -1.0, -1.0, -1.0, -1.0], |
2086 view); | 2178 view); |
2087 Expect.throws(() { view[-1] = 0.0; }, | 2179 Expect.throws(() { view[-1] = 0.0; }, |
2088 (e) { return e is IndexOutOfRangeException; }); | 2180 (e) { return e is IndexOutOfRangeException; }); |
2089 Expect.throws(() { return view[-1]; }, | 2181 Expect.throws(() { return view[-1]; }, |
2090 (e) { return e is IndexOutOfRangeException; }); | 2182 (e) { return e is IndexOutOfRangeException; }); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 testInt64ListView(); | 2260 testInt64ListView(); |
2169 testUint64ListView(); | 2261 testUint64ListView(); |
2170 testFloat32ListView(); | 2262 testFloat32ListView(); |
2171 testFloat64ListView(); | 2263 testFloat64ListView(); |
2172 } | 2264 } |
2173 } | 2265 } |
2174 | 2266 |
2175 main() { | 2267 main() { |
2176 ByteArrayTest.testMain(); | 2268 ByteArrayTest.testMain(); |
2177 } | 2269 } |
OLD | NEW |