OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, 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 | |
5 #library("boolified_operator_test.dart"); | |
6 #import("compiler_helper.dart"); | |
7 | |
8 final String TEST_EQUAL = @""" | |
9 foo(param0, param1) { | |
10 if (param0 == param1) return 0; | |
11 return 1; | |
12 } | |
13 """; | |
14 | |
15 final String TEST_EQUAL_NULL = @""" | |
16 foo(param0) { | |
17 if (param0 == null) return 0; | |
18 return 1; | |
19 } | |
20 """; | |
21 | |
22 final String TEST_LESS = @""" | |
23 foo(param0, param1) { | |
24 if (param0 < param1) return 0; | |
25 return 1; | |
26 } | |
27 """; | |
28 | |
29 final String TEST_LESS_EQUAL = @""" | |
30 foo(param0, param1) { | |
31 if (param0 <= param1) return 0; | |
32 return 1; | |
33 } | |
34 """; | |
35 final String TEST_GREATER = @""" | |
36 foo(param0, param1) { | |
37 if (param0 > param1) return 0; | |
38 return 1; | |
39 } | |
40 """; | |
41 | |
42 final String TEST_GREATER_EQUAL = @""" | |
43 foo(param0, param1) { | |
44 if (param0 >= param1) return 0; | |
45 return 1; | |
46 } | |
47 """; | |
48 | |
49 main() { | |
50 RegExp regexp = const RegExp('=== true'); | |
51 | |
52 String generated = compile(TEST_EQUAL, 'foo'); | |
53 Expect.isFalse(generated.contains('=== true')); | |
54 Expect.isTrue(generated.contains('eqB')); | |
55 | |
56 generated = compile(TEST_EQUAL_NULL, 'foo'); | |
57 Expect.isFalse(generated.contains('=== true')); | |
58 Expect.isTrue(generated.contains('eqNullB')); | |
59 | |
60 generated = compile(TEST_LESS, 'foo'); | |
61 Expect.isFalse(generated.contains('=== true')); | |
62 Expect.isTrue(generated.contains('ltB')); | |
63 | |
64 generated = compile(TEST_LESS_EQUAL, 'foo'); | |
65 Expect.isFalse(generated.contains('=== true')); | |
66 Expect.isTrue(generated.contains('leB')); | |
67 | |
68 generated = compile(TEST_GREATER, 'foo'); | |
69 Expect.isFalse(generated.contains('=== true')); | |
70 Expect.isTrue(generated.contains('gtB')); | |
71 | |
72 generated = compile(TEST_GREATER_EQUAL, 'foo'); | |
73 Expect.isFalse(generated.contains('=== true')); | |
74 Expect.isTrue(generated.contains('geB')); | |
75 } | |
OLD | NEW |