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

Unified Diff: tests/compiler/dart2js/sourcemaps/operators_test_file.dart

Issue 1250633002: Add operators test to source_mapping_test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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
Index: tests/compiler/dart2js/sourcemaps/operators_test_file.dart
diff --git a/tests/compiler/dart2js/sourcemaps/operators_test_file.dart b/tests/compiler/dart2js/sourcemaps/operators_test_file.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bbd85c021b6c707d6212ff77aad9865d1a758148
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/operators_test_file.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2015, 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.
+
+// Test file for testing source mappings of operations.
+
+var counter = 0;
+
+void record(result) {
+ counter++;
+}
+
+main(args) {
+ counter++;
+ operations(args.length > 0,
+ 0, 1.5, args[0], new Complex(0, 1), new Complex(1.5, 2.5));
+ return counter;
+}
+
+void operations(cond, a, b, c, d, e) {
+ if (cond) record(a + a);
+ if (cond) record(a + b);
+ if (cond) record(a + c);
+ if (cond) record(a + d);
+ if (cond) record(a + e);
+ if (cond) record(b + a);
+ if (cond) record(b + b);
+ if (cond) record(b + c);
+ if (cond) record(b + d);
+ if (cond) record(b + e);
+ if (cond) record(c + a);
+ if (cond) record(c + b);
+ if (cond) record(c + c);
+ if (cond) record(c + d);
+ if (cond) record(c + e);
+ if (cond) record(d + a);
+ if (cond) record(d + b);
+ if (cond) record(d + c);
+ if (cond) record(d + d);
+ if (cond) record(d + e);
+ if (cond) record(e + a);
+ if (cond) record(e + b);
+ if (cond) record(e + c);
+ if (cond) record(e + d);
+ if (cond) record(e + e);
+}
+
+class Complex {
+ final num re;
+ final num im;
+
+ const Complex(this.re, this.im);
+
+ operator +(Complex other) => new Complex(re + other.re, im + other.im);
+
+ // TODO(johnniwinther): Support implicit null check in '=='.
+ //operator ==(Complex other) => re == other.re && im == other.im;
+
+ int get hashCode => 13 * re.hashCode + 17 * im.hashCode;
+}
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/invokes_test_file.dart ('k') | tests/compiler/dart2js/sourcemaps/source_mapping_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698