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

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

Issue 1759973002: Add --no-background-compilation to tests that expect to run code in optimized form (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: more Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « tests/language/sync_generator1_test.dart ('k') | tests/language/try_catch2_test.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 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 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 // Dart test optimization of modulo operator on Smi. 4 // Dart test optimization of modulo operator on Smi.
5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr 5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-co mpilation
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 9
10 main() { 10 main() {
11 for (int i = -30; i < 30; i++) { 11 for (int i = -30; i < 30; i++) {
12 Expect.equals(i % 9, foo(i, 9)); 12 Expect.equals(i % 9, foo(i, 9));
13 // Zero test is done outside the loop. 13 // Zero test is done outside the loop.
14 if (i < 0) { 14 if (i < 0) {
15 Expect.equals(i ~/ -i, foo2(i)); 15 Expect.equals(i ~/ -i, foo2(i));
16 } else if (i > 0) { 16 } else if (i > 0) {
17 Expect.equals(i ~/ i, foo2(i)); 17 Expect.equals(i ~/ i, foo2(i));
18 } 18 }
19 } 19 }
20 Expect.throws(() => foo(12, 0), (e) => e is IntegerDivisionByZeroException); 20 Expect.throws(() => foo(12, 0), (e) => e is IntegerDivisionByZeroException);
21 Expect.throws(() => foo2(0), (e) => e is IntegerDivisionByZeroException); 21 Expect.throws(() => foo2(0), (e) => e is IntegerDivisionByZeroException);
22 } 22 }
23 23
24 foo(i, x) => i % x; 24 foo(i, x) => i % x;
25 25
26 foo2(i) { 26 foo2(i) {
27 // Make sure x has a range computed. 27 // Make sure x has a range computed.
28 var x = 0; 28 var x = 0;
29 if (i < 0) { 29 if (i < 0) {
30 x = -i; 30 x = -i;
31 } else { 31 } else {
32 x = i; 32 x = i;
33 } 33 }
34 return i ~/ x; 34 return i ~/ x;
35 } 35 }
OLDNEW
« no previous file with comments | « tests/language/sync_generator1_test.dart ('k') | tests/language/try_catch2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698