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

Side by Side Diff: tests/language/mint_compares.dart

Issue 11344011: Relational comparisons for unboxed mints. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed Srdjan's comments. Created 8 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
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Test compares on 64-bit integers. 5 // Test compares on 64-bit integers.
6 6
7
8 compareTest() { 7 compareTest() {
9 Expect.isFalse(4294967296 < 6); 8 Expect.isFalse(4294967296 < 6);
10 Expect.isFalse(4294967296 < 4294967296); 9 Expect.isFalse(4294967296 < 4294967296);
11 Expect.isFalse(4294967296 <= 6); 10 Expect.isFalse(4294967296 <= 6);
12 Expect.isTrue(4294967296 <= 4294967296); 11 Expect.isTrue(4294967296 <= 4294967296);
13 Expect.isFalse(4294967296 < 4294967295); 12 Expect.isFalse(4294967296 < 4294967295);
14 13
15 Expect.isTrue(-4294967296 < 6); 14 Expect.isTrue(-4294967296 < 6);
16 Expect.isTrue(-4294967296 < 4294967296); 15 Expect.isTrue(-4294967296 < 4294967296);
17 Expect.isTrue(-4294967296 <= 6); 16 Expect.isTrue(-4294967296 <= 6);
(...skipping 27 matching lines...) Expand all
45 Expect.isFalse(-4294967296 > -6); 44 Expect.isFalse(-4294967296 > -6);
46 Expect.isFalse(-4294967296 >= -6); 45 Expect.isFalse(-4294967296 >= -6);
47 Expect.isFalse(-4294967296 > -4294967295); 46 Expect.isFalse(-4294967296 > -4294967295);
48 47
49 Expect.isTrue(4294967296 < 184467440737095516150); 48 Expect.isTrue(4294967296 < 184467440737095516150);
50 Expect.isTrue(-4294967296 < 184467440737095516150); 49 Expect.isTrue(-4294967296 < 184467440737095516150);
51 Expect.isFalse(4294967296 < -184467440737095516150); 50 Expect.isFalse(4294967296 < -184467440737095516150);
52 Expect.isFalse(-4294967296 < -184467440737095516150); 51 Expect.isFalse(-4294967296 < -184467440737095516150);
53 } 52 }
54 53
54 compareTest2(lt, lte, gt, gte) {
55 Expect.isFalse(lt(4294967296, 6));
56 Expect.isFalse(lte(4294967296, 6));
57 Expect.isTrue(gt(4294967296, 6));
58 Expect.isTrue(gte(4294967296, 6));
59
60 Expect.isTrue(lte(-1, -1));
61 Expect.isTrue(gte(-1, -1));
62 Expect.isTrue(lte(-2, -1));
63 Expect.isFalse(gte(-2, -1));
64 Expect.isTrue(lte(-4294967296, -1));
65 Expect.isFalse(gte(-4294967296, -1));
66
67 Expect.isTrue(lt(-2, -1));
68 Expect.isFalse(gt(-2, -1));
69 Expect.isTrue(lt(-4294967296, -1));
70 Expect.isFalse(gt(-4294967296, -1));
71
72 Expect.isFalse(lt(-1, -4294967296));
73 Expect.isTrue(gt(-1, -4294967296));
74 Expect.isFalse(lt(2, -2));
75 Expect.isTrue(gt(2, -2));
76 Expect.isFalse(lt(4294967296, -1));
77 Expect.isTrue(gt(4294967296, -1));
78 }
79
80 bool lt1(a, b) => a < b;
81 bool lte1(a, b) => a <= b;
82 bool gt1(a, b) => a > b;
83 bool gte1(a, b) => a >= b;
84
85 bool lt2(a, b) => a < b ? true : false;
86 bool lte2(a, b) => a <= b ? true : false;
87 bool gt2(a, b) => a > b ? true : false;
88 bool gte2(a, b) => a >= b ? true : false;
55 89
56 main() { 90 main() {
57 for (var i = 0; i < 100; i++) { 91 for (var i = 0; i < 1000; i++) {
58 compareTest(); 92 compareTest();
93 compareTest2(lt1, lte1, gt1, gte1);
94 compareTest2(lt2, lte2, gt2, gte2);
59 } 95 }
60 } 96 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698