OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'setRange_lib.dart'; | 5 import 'setRange_lib.dart'; |
6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 clampingTest() { | 9 clampingTest() { |
10 var a1 = new Int8List(8); | 10 var a1 = new Int8List(8); |
11 var a2 = new Uint8ClampedList.view(a1); | 11 var a2 = new Uint8ClampedList.view(a1.buffer); |
12 initialize(a1); | 12 initialize(a1); |
13 Expect.equals('[1, 2, 3, 4, 5, 6, 7, 8]', '$a1'); | 13 Expect.equals('[1, 2, 3, 4, 5, 6, 7, 8]', '$a1'); |
14 Expect.equals('[1, 2, 3, 4, 5, 6, 7, 8]', '$a2'); | 14 Expect.equals('[1, 2, 3, 4, 5, 6, 7, 8]', '$a2'); |
15 a1[0] = -1; | 15 a1[0] = -1; |
16 a2.setRange(0, 2, a1); | 16 a2.setRange(0, 2, a1); |
17 Expect.equals('[0, 2, 3, 4, 5, 6, 7, 8]', '$a2'); | 17 Expect.equals('[0, 2, 3, 4, 5, 6, 7, 8]', '$a2'); |
18 } | 18 } |
19 | 19 |
20 main() { | 20 main() { |
21 clampingTest(); | 21 clampingTest(); |
22 } | 22 } |
OLD | NEW |