blob: f819ce944e8de27fd738a961e62f7befbe4d0c25 [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.
*/
/**
* @assertion E last
* Returns the last element.
* @description Checks that [last] can be set.
* @author msyabro
* @author sgrekhov@unipro.ru
* @issue dart-lang/co19#130
*/
import "dart:typed_data";
import "../../../Utils/expect.dart";
Float32x4 pack(v) => new Float32x4.splat(v);
equal(obj1, obj2) {
var res = obj1.equal(obj2);
return res.flagX && res.flagY && res.flagZ && res.flagW;
}
void check(List<Float32x4> array) {
dynamic l = new Float32x4List.fromList(array);
l.last = pack(3.14);
Expect.isTrue(equal(pack(3.14), l.last));
}
void checkClear(int length) {
dynamic l = new Float32x4List(length);
l.last = pack(3.14);
Expect.isTrue(equal(pack(3.14), l.last));
}
main() {
check([pack(1.0)]);
check([pack(1.0), pack(2.0), pack(3.0), pack(4.0), pack(5.0)]);
check([
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0), pack(0.0),
pack(0.0), pack(1.0)
]);
checkClear(1);
checkClear(100);
}