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

Side by Side Diff: dart/tests/lib/typed_data/uint32x4_sign_mask_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_sign_mask;
8
9 import 'dart:typed_data';
10 import 'package:expect/expect.dart';
11
12 void testImmediates() {
13 var f = new Uint32x4(1, 2, 3, 4);
14 var m = f.signMask;
15 Expect.equals(0x0, m);
16 f = new Uint32x4(-1, -2, -3, -4);
17 m = f.signMask;
18 Expect.equals(0xf, m);
19 f = new Uint32x4.bool(true, false, false, false);
20 m = f.signMask;
21 Expect.equals(0x1, m);
22 f = new Uint32x4.bool(false, true, false, false);
23 m = f.signMask;
24 Expect.equals(0x2, m);
25 f = new Uint32x4.bool(false, false, true, false);
26 m = f.signMask;
27 Expect.equals(0x4, m);
28 f = new Uint32x4.bool(false, false, false, true);
29 m = f.signMask;
30 Expect.equals(0x8, m);
31 }
32
33 void testZero() {
34 var f = new Uint32x4(0, 0, 0, 0);
35 var m = f.signMask;
36 Expect.equals(0x0, m);
37 f = new Uint32x4(-0, -0, -0, -0);
38 m = f.signMask;
39 Expect.equals(0x0, m);
40 }
41
42 void testLogic() {
43 var a = new Uint32x4(0x80000000, 0x80000000, 0x80000000, 0x80000000);
44 var b = new Uint32x4(0x70000000, 0x70000000, 0x70000000, 0x70000000);
45 var c = new Uint32x4(0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000);
46 var m1 = (a & c).signMask;
47 Expect.equals(0xf, m1);
48 var m2 = (a & b).signMask;
49 Expect.equals(0x0, m2);
50 var m3 = (b ^ a).signMask;
51 Expect.equals(0xf, m3);
52 var m4 = (b | c).signMask;
53 Expect.equals(0xf, m4);
54 }
55
56 main() {
57 for (int i = 0; i < 2000; i++) {
58 testImmediates();
59 testZero();
60 testLogic();
61 }
62 }
OLDNEW
« no previous file with comments | « dart/tests/lib/typed_data/uint32x4_shuffle_test.dart ('k') | dart/tests/standalone/io/http_advanced_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698