| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 point_test; | 5 library point_test; |
| 6 | 6 |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 test('constructor', () { | 11 test('constructor', () { |
| 12 var point = new Point(); | 12 var point = new Point(0, 0); |
| 13 expect(point.x, 0); | 13 expect(point.x, 0); |
| 14 expect(point.y, 0); | 14 expect(point.y, 0); |
| 15 expect('$point', 'Point(0, 0)'); | 15 expect('$point', 'Point(0, 0)'); |
| 16 }); | 16 }); |
| 17 | 17 |
| 18 test('constructor X', () { | 18 test('constructor X', () { |
| 19 var point = new Point<int>(10); | 19 var point = new Point<int>(10, 0); |
| 20 expect(point.x, 10); | 20 expect(point.x, 10); |
| 21 expect(point.y, 0); | 21 expect(point.y, 0); |
| 22 expect('$point', 'Point(10, 0)'); | 22 expect('$point', 'Point(10, 0)'); |
| 23 }); | 23 }); |
| 24 | 24 |
| 25 test('constructor X Y', () { | 25 test('constructor X Y', () { |
| 26 var point = new Point<int>(10, 20); | 26 var point = new Point<int>(10, 20); |
| 27 expect(point.x, 10); | 27 expect(point.x, 10); |
| 28 expect(point.y, 20); | 28 expect(point.y, 20); |
| 29 expect('$point', 'Point(10, 20)'); | 29 expect('$point', 'Point(10, 20)'); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 test('magnitute', () { | 81 test('magnitute', () { |
| 82 var a = new Point(5, 10); | 82 var a = new Point(5, 10); |
| 83 var b = new Point(0, 0); | 83 var b = new Point(0, 0); |
| 84 expect(a.magnitude, a.distanceTo(b)); | 84 expect(a.magnitude, a.distanceTo(b)); |
| 85 expect(b.magnitude, 0); | 85 expect(b.magnitude, 0); |
| 86 | 86 |
| 87 var c = new Point(-5, -10); | 87 var c = new Point(-5, -10); |
| 88 expect(c.magnitude, a.distanceTo(b)); | 88 expect(c.magnitude, a.distanceTo(b)); |
| 89 }); | 89 }); |
| 90 } | 90 } |
| OLD | NEW |