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

Side by Side Diff: tests/language_strong/assign_op_test.dart

Issue 2990773002: Migrate language/arithmetic2_test ... language/async_await_syntax_test. (Closed)
Patch Set: Update migrated tests and statuses to Dart 2.0. Created 3 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4 // Dart test program for testing assign operators.
5 // VMOptions=--optimization-counter-threshold=10
6
7 import "package:expect/expect.dart";
8
9 class AssignOpTest {
10 AssignOpTest() {}
11
12 static testMain() {
13 var b = 0;
14 b += 1;
15 Expect.equals(1, b);
16 b *= 5;
17 Expect.equals(5, b);
18 b -= 1;
19 Expect.equals(4, b);
20 b ~/= 2;
21 Expect.equals(2, b);
22
23 f = 0;
24 f += 1;
25 Expect.equals(1, f);
26 f *= 5;
27 Expect.equals(5, f);
28 f -= 1;
29 Expect.equals(4, f);
30 f ~/= 2;
31 Expect.equals(2, f);
32 f /= 4;
33 Expect.equals(.5, f);
34
35 AssignOpTest.f = 0;
36 AssignOpTest.f += 1;
37 Expect.equals(1, AssignOpTest.f);
38 AssignOpTest.f *= 5;
39 Expect.equals(5, AssignOpTest.f);
40 AssignOpTest.f -= 1;
41 Expect.equals(4, AssignOpTest.f);
42 AssignOpTest.f ~/= 2;
43 Expect.equals(2, AssignOpTest.f);
44 AssignOpTest.f /= 4;
45 Expect.equals(.5, f);
46
47 var o = new AssignOpTest();
48 o.instf = 0;
49 o.instf += 1;
50 Expect.equals(1, o.instf);
51 o.instf *= 5;
52 Expect.equals(5, o.instf);
53 o.instf -= 1;
54 Expect.equals(4, o.instf);
55 o.instf ~/= 2;
56 Expect.equals(2, o.instf);
57 o.instf /= 4;
58 Expect.equals(.5, o.instf);
59
60 var x = 0xFF;
61 x >>= 3;
62 Expect.equals(0x1F, x);
63 x <<= 3;
64 Expect.equals(0xF8, x);
65 x |= 0xF00;
66 Expect.equals(0xFF8, x);
67 x &= 0xF0;
68 Expect.equals(0xF0, x);
69 x ^= 0x11;
70 Expect.equals(0xE1, x);
71
72 var y = 100;
73 y += 1 << 3;
74 Expect.equals(108, y);
75 y *= 2 + 1;
76 Expect.equals(324, y);
77 y -= 3 - 2;
78 Expect.equals(323, y);
79 y += 3 * 4;
80 Expect.equals(335, y);
81
82 var a = [1, 2, 3];
83 var ix = 0;
84 a[ix] |= 12;
85 Expect.equals(13, a[ix]);
86 }
87
88 static var f;
89 var instf;
90 }
91
92 main() {
93 for (int i = 0; i < 20; i++) {
94 AssignOpTest.testMain();
95 }
96 }
OLDNEW
« no previous file with comments | « tests/language_strong/assign_instance_method_negative_test.dart ('k') | tests/language_strong/assign_static_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698