| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 | 4 |
| 5 // Tests of operators. | 5 // Tests of operators. |
| 6 | 6 |
| 7 library operators_tests; | 7 library operators_tests; |
| 8 | 8 |
| 9 import 'js_backend_cps_ir.dart'; | 9 import 'js_backend_cps_ir.dart'; |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 }"""), | 67 }"""), |
| 68 | 68 |
| 69 const TestEntry.forMethod('function(foo)', | 69 const TestEntry.forMethod('function(foo)', |
| 70 r""" | 70 r""" |
| 71 foo(a) => a ~/ 13; | 71 foo(a) => a ~/ 13; |
| 72 main() { | 72 main() { |
| 73 print(foo(5)); | 73 print(foo(5)); |
| 74 print(foo(-100)); | 74 print(foo(-100)); |
| 75 }""", r""" | 75 }""", r""" |
| 76 function(a) { | 76 function(a) { |
| 77 var v0; | 77 return (a | 0) === a && (13 | 0) === 13 ? a / 13 | 0 : J.toInt$0$n(a / 13); |
| 78 return (a | 0) === a && (13 | 0) === 13 ? a / 13 | 0 : J.getInterceptor$n(v0 =
a / 13).toInt$0(v0); | |
| 79 }"""), | 78 }"""), |
| 80 | 79 |
| 81 const TestEntry(r""" | 80 const TestEntry(r""" |
| 82 foo(a) => a ~/ 13; | 81 foo(a) => a ~/ 13; |
| 83 main() { | 82 main() { |
| 84 print(foo(5)); | 83 print(foo(5)); |
| 85 print(foo(100)); | 84 print(foo(100)); |
| 86 }""", r""" | 85 }""", r""" |
| 87 function() { | 86 function() { |
| 88 P.print(5 / 13 | 0); | 87 P.print(5 / 13 | 0); |
| 89 P.print(100 / 13 | 0); | 88 P.print(100 / 13 | 0); |
| 90 }"""), | 89 }"""), |
| 91 | 90 |
| 92 const TestEntry.forMethod('function(foo)', | 91 const TestEntry.forMethod('function(foo)', |
| 93 r""" | 92 r""" |
| 94 foo(a) => a ~/ 13; | 93 foo(a) => a ~/ 13; |
| 95 main() { | 94 main() { |
| 96 print(foo(5)); | 95 print(foo(5)); |
| 97 print(foo(8000000000)); | 96 print(foo(8000000000)); |
| 98 }""", r""" | 97 }""", r""" |
| 99 function(a) { | 98 function(a) { |
| 100 var v0; | 99 return (a | 0) === a && (13 | 0) === 13 ? a / 13 | 0 : J.toInt$0$n(a / 13); |
| 101 return (a | 0) === a && (13 | 0) === 13 ? a / 13 | 0 : J.getInterceptor$n(v0 =
a / 13).toInt$0(v0); | |
| 102 }"""), | 100 }"""), |
| 103 | 101 |
| 104 ]; | 102 ]; |
| 105 | 103 |
| 106 void main() { | 104 void main() { |
| 107 runTests(tests); | 105 runTests(tests); |
| 108 } | 106 } |
| OLD | NEW |