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

Side by Side Diff: dart/tests/lib/typed_data/uint32x4_shuffle_test.dart

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4 // VMOptions=--optimization-counter-threshold=10
5
6 // Library tag to be able to run in html test framework.
7 library uint32x4_shuffle_test;
8
9 import "package:expect/expect.dart";
10 import 'dart:typed_data';
11
12 void testShuffle() {
13 var m = new Uint32x4(1, 2, 3, 4);
14 var c;
15 c = m.shuffle(Uint32x4.WZYX);
16 Expect.equals(4, c.x);
17 Expect.equals(3, c.y);
18 Expect.equals(2, c.z);
19 Expect.equals(1, c.w);
20 }
21
22 void testShuffleNonConstant(mask) {
23 var m = new Uint32x4(1, 2, 3, 4);
24 var c;
25 c = m.shuffle(mask);
26 if (mask == 1) {
27 Expect.equals(2, c.x);
28 Expect.equals(1, c.y);
29 Expect.equals(1, c.z);
30 Expect.equals(1, c.w);
31 } else {
32 Expect.equals(Uint32x4.YYYY + 1, mask);
33 Expect.equals(3, c.x);
34 Expect.equals(2, c.y);
35 Expect.equals(2, c.z);
36 Expect.equals(2, c.w);
37 }
38 }
39
40 void testShuffleMix() {
41 var m = new Uint32x4(1, 2, 3, 4);
42 var n = new Uint32x4(5, 6, 7, 8);
43 var c = m.shuffleMix(n, Uint32x4.XYXY);
44 Expect.equals(1, c.x);
45 Expect.equals(2, c.y);
46 Expect.equals(5, c.z);
47 Expect.equals(6, c.w);
48 }
49
50 main() {
51 var xxxx = Uint32x4.XXXX + 1;
52 var yyyy = Uint32x4.YYYY + 1;
53 for (int i = 0; i < 20; i++) {
54 testShuffle();
55 testShuffleNonConstant(xxxx);
56 testShuffleNonConstant(yyyy);
57 testShuffleMix();
58 }
59 }
OLDNEW
« no previous file with comments | « dart/tests/lib/typed_data/uint32x4_list_test.dart ('k') | dart/tests/lib/typed_data/uint32x4_sign_mask_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698