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

Unified Diff: frog/tests/leg_only/src/CompileTimeConstant3Test.dart

Issue 9427012: Allow binary operators on compile-time-constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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: frog/tests/leg_only/src/CompileTimeConstant3Test.dart
diff --git a/frog/tests/leg_only/src/CompileTimeConstant3Test.dart b/frog/tests/leg_only/src/CompileTimeConstant3Test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e314bc902a1bdab6ab64a69781ac26a5eaa649be
--- /dev/null
+++ b/frog/tests/leg_only/src/CompileTimeConstant3Test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2012, 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.
+
+final x = 19.5;
+final y = 3.3;
+final g1 = x + y;
+final g2 = x * y;
+final g3 = x / y;
+final g4 = x ~/ y;
+final g5 = -x;
+final g6 = x < y;
+final g7 = x <= y;
+final g8 = x <= x;
+final g9 = x > y;
+final g10 = x >= y;
+final g11 = x >= x;
+final g12 = x == y;
+final g13 = x == x;
+final g14 = x != y;
+final g15 = x != x;
+final g16 = g1 + g2 + g3 + g4 + g5;
+final g17 = x % y;
+
+main() {
+ Expect.equals(22.8, g1);
+ Expect.equals(64.35, g2);
+ Expect.equals(5.909090909090909, g3);
+ Expect.equals(5.0, g4);
+ Expect.equals(-19.5, g5);
+ Expect.equals(false, g6);
+ Expect.equals(false, g7);
+ Expect.equals(true, g8);
+ Expect.equals(true, g9);
+ Expect.equals(true, g10);
+ Expect.equals(true, g11);
+ Expect.equals(false, g12);
+ Expect.equals(true, g13);
+ Expect.equals(true, g14);
+ Expect.equals(false, g15);
+ Expect.equals(78.5590909090909, g16);
+ Expect.equals(3.000000000000001, g17);
+}

Powered by Google App Engine
This is Rietveld 408576698