blob: 7bb21160b47354e2d972ec48e24f453f14dd0070 [file] [log] [blame]
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
/// @assertion
/// Uint64List.view(
/// ByteBuffer buffer, [
/// int offsetInBytes = 0,
/// int length
/// ])
/// ...
/// Throws [ArgumentError] if [offsetInBytes] is not a multiple of
/// BYTES_PER_ELEMENT.
/// @description Checks that [ArgumentError] is thrown if [offsetInBytes] is
/// not a multiple of BYTES_PER_ELEMENT.
/// @author msyabro
import "dart:typed_data";
import "../../../Utils/expect.dart";
main() {
var list = new Uint64List(2);
var buffer = list.buffer;
for (int i = 1; i < Uint64List.bytesPerElement; ++i) {
try {
new Uint64List.view(buffer, i);
Expect.fail("ArgumentError is expected");
} on ArgumentError {}
}
}