OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 library int32test; | 5 library int32test; |
6 import '../lib/fixnum.dart'; | 6 import '../lib/fixnum.dart'; |
7 | 7 |
8 void main() { | 8 void main() { |
9 Expect.equals("0", new int32.fromInt(0).toString()); | 9 Expect.equals("0", new int32.fromInt(0).toString()); |
10 Expect.equals("1", new int32.fromInt(1).toString()); | 10 Expect.equals("1", new int32.fromInt(1).toString()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 Expect.equals(new int32.fromInt(0x12345678 >> 7), | 126 Expect.equals(new int32.fromInt(0x12345678 >> 7), |
127 new int32.fromInt(0x12345678) >> 7); | 127 new int32.fromInt(0x12345678) >> 7); |
128 Expect.equals(new int32.fromInt(0x12345678 << 7), | 128 Expect.equals(new int32.fromInt(0x12345678 << 7), |
129 new int32.fromInt(0x12345678) << 7); | 129 new int32.fromInt(0x12345678) << 7); |
130 Expect.equals(new int32.fromInt(0x12345678 >> 7), | 130 Expect.equals(new int32.fromInt(0x12345678 >> 7), |
131 new int32.fromInt(0x12345678).shiftRightUnsigned(7)); | 131 new int32.fromInt(0x12345678).shiftRightUnsigned(7)); |
132 | 132 |
133 try { | 133 try { |
134 new int32.fromInt(17) < null; | 134 new int32.fromInt(17) < null; |
135 Expect.fail("x < null should throw ArgumentError"); | 135 Expect.fail("x < null should throw NullPointerException"); |
136 } on ArgumentError catch (e) { | 136 } on NullPointerException catch (e) { |
137 } | 137 } |
138 | 138 |
139 try { | 139 try { |
140 new int32.fromInt(17) <= null; | 140 new int32.fromInt(17) <= null; |
141 Expect.fail("x <= null should throw ArgumentError"); | 141 Expect.fail("x <= null should throw NullPointerException"); |
142 } on ArgumentError catch (e) { | 142 } on NullPointerException catch (e) { |
143 } | 143 } |
144 | 144 |
145 try { | 145 try { |
146 new int32.fromInt(17) > null; | 146 new int32.fromInt(17) > null; |
147 Expect.fail("x > null should throw ArgumentError"); | 147 Expect.fail("x > null should throw NullPointerException"); |
148 } on ArgumentError catch (e) { | 148 } on NullPointerException catch (e) { |
149 } | 149 } |
150 | 150 |
151 try { | 151 try { |
152 new int32.fromInt(17) < null; | 152 new int32.fromInt(17) < null; |
153 Expect.fail("x >= null should throw ArgumentError"); | 153 Expect.fail("x >= null should throw NullPointerException"); |
154 } on ArgumentError catch (e) { | 154 } on NullPointerException catch (e) { |
155 } | 155 } |
156 | 156 |
157 Expect.isFalse(new int32.fromInt(17) == null); | 157 Expect.isFalse(new int32.fromInt(17) == null); |
158 } | 158 } |
OLD | NEW |