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

Unified Diff: tests/language/strict_equal_test.dart

Issue 10977020: In strict comarison use constants instead of registers if possible. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/strict_equal_test.dart
===================================================================
--- tests/language/strict_equal_test.dart (revision 0)
+++ tests/language/strict_equal_test.dart (revision 0)
@@ -0,0 +1,77 @@
+// Copyright (c) 2011, 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.
+
+
+main() {
+ for (int i = 0; i < 6000; i++) {
+ Expect.isFalse(test1(5));
+ Expect.isTrue(test1(3));
+
+ Expect.isTrue(test2(5));
+ Expect.isFalse(test2(3));
+
+ Expect.isTrue(test2r(5));
+ Expect.isFalse(test2r(3));
+
+ Expect.isTrue(test3());
+
+ Expect.equals(2, test4(5));
+ Expect.equals(1, test4(3));
+
+ Expect.equals(1, test5(5));
+ Expect.equals(2, test5(3));
+
+ Expect.equals(1, test6());
+ }
+}
+
+
+test1(a) {
+ return a === 3;
+}
+
+test2(a) {
+ return a !== 3;
+}
+
+
+test2r(a) {
+ return 3 !== a;
+}
+
+
+test3() {
+ return get5() === 5;
+}
+
+
+test4(a) {
+ if (a === 3) {
+ return 1;
+ } else {
+ return 2;
+ }
+}
+
+
+test5(a) {
+ if (a !== 3) {
+ return 1;
+ } else {
+ return 2;
+ }
+}
+
+
+test6() {
+ if (get5() === 5) {
+ return 1;
+ } else {
+ return 2;
+ }
+}
+
+get5() {
+ return 5;
+}
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698