| OLD | NEW | 
 | (Empty) | 
|    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 |  | 
|    3 // BSD-style license that can be found in the LICENSE file. |  | 
|    4  |  | 
|    5 // Tests of operators. |  | 
|    6  |  | 
|    7 library operators2_tests; |  | 
|    8  |  | 
|    9 import 'js_backend_cps_ir.dart'; |  | 
|   10  |  | 
|   11 const List<TestEntry> tests = const [ |  | 
|   12  |  | 
|   13   const TestEntry(r""" |  | 
|   14 foo(a, b) => ((a & 0xff0000) >> 1) & b; |  | 
|   15 main() { |  | 
|   16   print(foo(123, 234)); |  | 
|   17   print(foo(0, 2)); |  | 
|   18 }""", r""" |  | 
|   19 function() { |  | 
|   20   P.print((123 & 16711680) >>> 1 & 234); |  | 
|   21   P.print((0 & 16711680) >>> 1 & 2); |  | 
|   22 }"""), |  | 
|   23  |  | 
|   24   const TestEntry(r""" |  | 
|   25 foo(a) => ~a; |  | 
|   26 main() { |  | 
|   27   print(foo(1)); |  | 
|   28   print(foo(10)); |  | 
|   29 }""", r""" |  | 
|   30 function() { |  | 
|   31   P.print(~1 >>> 0); |  | 
|   32   P.print(~10 >>> 0); |  | 
|   33 }"""), |  | 
|   34  |  | 
|   35   const TestEntry.forMethod('function(foo)', |  | 
|   36       r""" |  | 
|   37 foo(a) => a % 13; |  | 
|   38 main() { |  | 
|   39   print(foo(5)); |  | 
|   40   print(foo(-100)); |  | 
|   41 }""", r""" |  | 
|   42 function(a) { |  | 
|   43   var result = a % 13; |  | 
|   44   return result === 0 ? 0 : result > 0 ? result : 13 < 0 ? result - 13 : result 
     + 13; |  | 
|   45 }"""), |  | 
|   46  |  | 
|   47   const TestEntry(r""" |  | 
|   48 foo(a) => a % 13; |  | 
|   49 main() { |  | 
|   50   print(foo(5)); |  | 
|   51   print(foo(100)); |  | 
|   52 }""", r""" |  | 
|   53 function() { |  | 
|   54   P.print(5 % 13); |  | 
|   55   P.print(100 % 13); |  | 
|   56 }"""), |  | 
|   57  |  | 
|   58   const TestEntry(r""" |  | 
|   59 foo(a) => a.remainder(13); |  | 
|   60 main() { |  | 
|   61   print(foo(5)); |  | 
|   62   print(foo(-100)); |  | 
|   63 }""", r""" |  | 
|   64 function() { |  | 
|   65   P.print(5 % 13); |  | 
|   66   P.print(-100 % 13); |  | 
|   67 }"""), |  | 
|   68  |  | 
|   69   const TestEntry.forMethod('function(foo)', |  | 
|   70       r""" |  | 
|   71 foo(a) => a ~/ 13; |  | 
|   72 main() { |  | 
|   73   print(foo(5)); |  | 
|   74   print(foo(-100)); |  | 
|   75 }""", r""" |  | 
|   76 function(a) { |  | 
|   77   return (a | 0) === a && (13 | 0) === 13 ? a / 13 | 0 : J.toInt$0$n(a / 13); |  | 
|   78 }"""), |  | 
|   79  |  | 
|   80   const TestEntry(r""" |  | 
|   81 foo(a) => a ~/ 13; |  | 
|   82 main() { |  | 
|   83   print(foo(5)); |  | 
|   84   print(foo(100)); |  | 
|   85 }""", r""" |  | 
|   86 function() { |  | 
|   87   P.print(5 / 13 | 0); |  | 
|   88   P.print(100 / 13 | 0); |  | 
|   89 }"""), |  | 
|   90  |  | 
|   91   const TestEntry.forMethod('function(foo)', |  | 
|   92       r""" |  | 
|   93 foo(a) => a ~/ 13; |  | 
|   94 main() { |  | 
|   95   print(foo(5)); |  | 
|   96   print(foo(8000000000)); |  | 
|   97 }""", r""" |  | 
|   98 function(a) { |  | 
|   99   return (a | 0) === a && (13 | 0) === 13 ? a / 13 | 0 : J.toInt$0$n(a / 13); |  | 
|  100 }"""), |  | 
|  101  |  | 
|  102 ]; |  | 
|  103  |  | 
|  104 void main() { |  | 
|  105   runTests(tests); |  | 
|  106 } |  | 
| OLD | NEW |