Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
|
siva
2012/02/02 00:04:26
2012, some other files may also have to be updated
srdjan
2012/02/02 19:07:53
Changed all modified test files 2011 -> 2012
| |
| 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 // Dart test program for testing the instanceof operation. | 4 // Dart test program for testing the instanceof operation. |
| 5 | 5 |
| 6 | |
| 7 testIsNegative() { | |
| 8 Expect.isFalse((12.0).isNegative()); | |
| 9 Expect.isTrue((-12.0).isNegative()); | |
| 10 Expect.isFalse((double.NAN).isNegative()); | |
| 11 Expect.isFalse((0.0).isNegative()); | |
| 12 Expect.isTrue((-0.0).isNegative()); | |
| 13 Expect.isFalse((double.INFINITY).isNegative()); | |
| 14 Expect.isTrue((double.NEGATIVE_INFINITY).isNegative()); | |
| 15 } | |
| 16 | |
| 17 testIsNaN() { | |
| 18 Expect.isFalse((1.0).isNaN()); | |
| 19 Expect.isTrue((double.NAN).isNaN()); | |
| 20 } | |
| 21 | |
| 22 | |
| 23 testTrigonometric() { | |
| 24 Expect.approxEquals(1.0, Math.sin(Math.PI / 2.0), 0.0001); | |
| 25 Expect.approxEquals(1.0, Math.cos(0), 0.0001); | |
| 26 Expect.approxEquals(1.0, Math.cos(0.0), 0.0001); | |
| 27 } | |
| 28 | |
| 6 num foo(int n) { | 29 num foo(int n) { |
| 7 var x; | 30 var x; |
| 8 for(var i = 0; i <= n; ++i) | 31 for(var i = 0; i <= n; ++i) { |
| 9 x = Math.sqrt(i); | 32 Expect.equals(2.0, Math.sqrt(4.0)); |
| 33 testIsNegative(); | |
| 34 testIsNaN(); | |
| 35 testTrigonometric(); | |
| 36 } | |
| 10 return x; | 37 return x; |
| 11 } | 38 } |
| 12 | 39 |
| 13 void main() { | 40 void main() { |
| 14 var m = foo(40000); | 41 var m = foo(4000); |
| 15 } | 42 } |
| OLD | NEW |